0

I'm setting up a new Macbook Pro, but strangely the command line shortcuts I expect to work after pip3 install are all not working. For example:

Kurts-MacBook-Pro:~ kurtpeek$ pip3 install --upgrade virtualenv
Requirement already up-to-date: virtualenv in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Kurts-MacBook-Pro:~ kurtpeek$ virtualenv venv
-bash: virtualenv: command not found

Shows that virtualenv is not working. Similarly,

Kurts-MacBook-Pro:~ kurtpeek$ pip3 install --upgrade ipython
Requirement already up-to-date: ipython in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already up-to-date: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: traitlets>=4.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: pickleshare in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: appnope; sys_platform == "darwin" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: pygments in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: setuptools>=18.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: simplegeneric>0.8 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: decorator in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: jedi>=0.10 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: pexpect; sys_platform != "win32" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: six>=1.9.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already up-to-date: wcwidth in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already up-to-date: ipython-genutils in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from traitlets>=4.2->ipython)
Requirement already up-to-date: parso==0.1.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from jedi>=0.10->ipython)
Requirement already up-to-date: ptyprocess>=0.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pexpect; sys_platform != "win32"->ipython)

followed by

Kurts-MacBook-Pro:~ kurtpeek$ ipython
-bash: ipython: command not found

In short, it seems like the command line shortcuts corresponding to these programs are not being installed correctly for some reason. Any idea what could be wrong?

phd
  • 82,685
  • 13
  • 120
  • 165
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
  • 1
    are you running the ipython command in the same terminal? open another one, the paths are not sourced by the install command. – Jean-François Fabre Jan 08 '18 at 20:01
  • 2
    I'm sure they're installed correctly but they're in a `bin` directory that's not in your `$PATH`. See https://stackoverflow.com/q/31133050/7976758 – phd Jan 08 '18 at 21:05
  • 1
    How did you install `python3` and `pip3`? Did you download `.dmg` installer from official Python website or did you install one via Homebrew? Or did you install both? Most of the errors like you experience are due to installing both and then mixing up the two installations in `PATH`. Please post the output of `which python3`, `which pip3`, `pip3 -V` and `echo $PATH`. – hoefling Jan 08 '18 at 22:12

1 Answers1

0

virtualenv is not a command out of the box with Python 3 (or at least the Homebrew variant I have). The command to create a virtualenv is

python3 -mvenv dir

to create a virtualenv in dir, and (in Bash)

. dir/bin/activate

to activate it.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • 2
    After the OP has done `pip3 install --upgrade virtualenv` virtualenv **is** a command. – phd Jan 08 '18 at 21:06