So I’m on the install pipenv lesson ( https://www.codecademy.com/courses/learn-python-3/videos/learn-python3-pipenv )

when it comes to install pipenv it would seem like I have no errors but when I try to check version or run it I get the ‘command not found error’.

still new to all this so deciphering what is infant of me is still a struggle my I have the terminal information below. If someone can help me in directing me where it going wrong that would be gratefully appreciated.

he default interactive shell is now zsh.

To update your account to use zsh, please run chsh -s /bin/zsh.

For more details, please visit https://support.apple.com/kb/HT208050.

(base) Kevins-Air:~ kev$ pipenv --version

-bash: pipenv: command not found

(base) Kevins-Air:~ kev$ pip install–user pipenv

ERROR: unknown command “install–user” - maybe you meant “install”

(base) Kevins-Air:~ kev$ pip install --user pipenv

Requirement already satisfied: pipenv in ./.local/lib/python3.7/site-packages (2020.6.2)

Requirement already satisfied: pip>=18.0 in /opt/anaconda3/lib/python3.7/site-packages (from pipenv) (19.2.3)

Requirement already satisfied: setuptools>=36.2.1 in /opt/anaconda3/lib/python3.7/site-packages (from pipenv) (41.4.0)

Requirement already satisfied: virtualenv-clone>=0.2.5 in ./.local/lib/python3.7/site-packages (from pipenv) (0.5.4)

Requirement already satisfied: virtualenv in ./.local/lib/python3.7/site-packages (from pipenv) (20.0.21)

Requirement already satisfied: certifi in /opt/anaconda3/lib/python3.7/site-packages (from pipenv) (2019.9.11)

Requirement already satisfied: filelock<4,>=3.0.0 in /opt/anaconda3/lib/python3.7/site-packages (from virtualenv->pipenv) (3.0.12)

Requirement already satisfied: distlib<1,>=0.3.0 in ./.local/lib/python3.7/site-packages (from virtualenv->pipenv) (0.3.0)

Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < “3.8” in /opt/anaconda3/lib/python3.7/site-packages (from virtualenv->pipenv) (0.23)

Requirement already satisfied: six<2,>=1.9.0 in /opt/anaconda3/lib/python3.7/site-packages (from virtualenv->pipenv) (1.12.0)

Requirement already satisfied: appdirs<2,>=1.4.3 in ./.local/lib/python3.7/site-packages (from virtualenv->pipenv) (1.4.4)

Requirement already satisfied: zipp>=0.5 in /opt/anaconda3/lib/python3.7/site-packages (from importlib-metadata<2,>=0.12; python_version < “3.8”->virtualenv->pipenv) (0.6.0)

Requirement already satisfied: more-itertools in /opt/anaconda3/lib/python3.7/site-packages (from zipp>=0.5->importlib-metadata<2,>=0.12; python_version < “3.8”->virtualenv->pipenv) (7.2.0)

(base) Kevins-Air:~ kev$ pipenv --version

-bash: pipenv: command not found

(base) Kevins-Air:~ kev$ pipenv

-bash: pipenv: command not found

(base) Kevins-Air:~ kev$

It looks like it’s isntalled on your system but it has not been added to your path. Can you run it with python -m pipenv (or potentially python3 -m pipenv)? If you had to add it to your path I think this would require editing .zshrc buy ou might have to search around a bit to find a nice guide if it’s not that straightforward.

Hi, I am having the same issue. I am on mac and downloaded Python 3.8.3 and pip today. I downloaded 3.8.3 because I realised mac by default runs 2.7 but I had forgotten that I had downloaded python3 during the command line units of the course. I think this downloads version 3.7.3. I think my pipenv is under /Users/username/Library/Python/3.7/bin but when I go python3 -m pipenv this comes up
“/Library/Frameworks/Python.framework/Versions/3.8/bin/python3: No module named pipenv”
I think the discrepancy is between the Python 3.7 and 3.8, would anyone know how to fix this?

If you want to run a specific file, then run that file.

if you want a different result when searching for an executable then alter the things involved in that search so that the one you meant comes first

there isn’t necessarily anything to fix. it’s your environment to control, there’s nothing saying how things should be other than how you yourself arrange it.

in a gui there are few choices, typically all correct. for a text interface you have to make your own choices and specify things that make sense. you have to choose which python version you want to be using, and then you’d ensure pipenv is installed there, and then you’d run pipenv, there. if you then just run “some” pipenv then you’re no longer specifying which you meant unless you very deliberately put a particular one at the front of your search path.

pick something and make it so.

Thanks tgrtim and inoatan! With a bit of playing around I have managed to get python3 -m pipenv to work for me. Appreciate all the ehlp you give on these forums

Hello all,

I have a similar issue… in this video:


I followed the instructions as indicated but got this error in the virtual shell:

>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'

This is what my .bash_profile looks like:

# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
export PATH
alias python="python3"
alias pip="pip3"

export PATH="/Users/elykarr/Library/Python/3.7/bin:$PATH"

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
    if [ -f "/opt/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/miniconda3/etc/profile.d/conda.sh"
        export PATH="/opt/miniconda3/bin:$PATH"
unset __conda_setup
# <<< conda initialize <<<

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
export PATH

Have I done something wrong? Any suggestions?

Also, when I restarted my terminal after updated my bash_profile, I was notified that the default shell is now zsh. Any ideas why this happened?

Thanks in advance for your help.

Edit: Found the relevant location on the conda docs which might be the easier option for now-

DIrect quote from that link-
MacOS Catalina
If you are on macOS Catalina, the new default shell is zsh. You will instead need to run source <path to conda>/bin/activate followed by conda init zsh .

It’s a bit difficult to say without knowing what interpeter you’re using and the commands you used to get there. Whatever you’re using to run that scipt doesn’t appear to have a copy of numpy in the same environment.

If you’re running a zsh shell rather than bash you’d need to make sure the commands to alter the path are in your zsh profile (probably under the file name .zshrc) and I assume conda has details on how to perform this on their site (I think this is a recognised issue for osx catalina but the process should be similar if it’s something else).

Hopefully you can get conda working on your path and then you can ignore the rest-

If not you can double check the version quickly with import sys and on another line print(sys.version).

It’s possible you’re either on the system Python (which is probably 2.7.x), a local install of Python (which is at 3.8) or the conda version (which is at 3.7 and seems most likely considering your bash profile). It’s probably best to keep the system Python untouched.

It’d be best to look into virtual environments for this sort of thing (note that has conda its own virtual environment set-up) but that’s more detail than I stick in this post but defintiely check them out sooner rather than later.

If you’re using conda something along the lines of conda install numpy should make it accessible to whatever interpreter you’re using. Considering conda is on your path it’s not likely you’ve wound up in an environmnet running 3.8 but if it is for some reason I’d hazard a guess you’d need to use pip3 install numpy (pip would still be installing packages for 2.7 which should be avoided unless conda masks it).

A bit of detail on virtual environments-

1 Like