I am completely new to Python, so in order to do some practice and whatnot decided to create a venv, when I found out those exist, and do it all there.
I'm on macOS X so I already have Python2 but obviously went to get 3.
I installed the latest Python version with its package from python.org itself. Tried to get pip and venv but wouldn't work. So, then I installed Homebrew and also run the code to install python3 as well because I read it would come with pip already among other things.
It didn't come with pip and it proved terribly difficult to install it. Also creating a venv has gotten me lost since I never coded in Python before.
I've gotten everything I've done in the Terminal
I installed the latest Python3.7.3 for Mac OS X from https://www.python.org/downloads/ I ran the package and it would also supposedly come with everything but when I ran
MacBook-Air:~ maria$ pip --version
-bash: pip: command not found
So I did what their guide to install pip said
MacBook-Air:~ maria$ python -m ensurepip --default-pip
Ignoring indexes: https://pypi.python.org/simple
Requirement already satisfied (use --upgrade to upgrade): setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Collecting pip
Installing collected packages: pip
Exception:
Traceback (most recent call last):
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 693, in install
**kwargs
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/req/req_install.py", line 817, in install
self.move_wheel_files(self.source_dir, root=root)
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/req/req_install.py", line 1018, in move_wheel_files
isolated=self.isolated,
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/wheel.py", line 237, in move_wheel_files
clobber(source, lib_dir, True)
File "/var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpefPJJh/pip-6.1.1-py2.py3-none-any.whl/pip/wheel.py", line 208, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
Then I did
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
with the result
Installing collected packages: pip, wheel
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
Consider using the `--user` option or check the permissions.
Then I even installed command line developer tools from Xcode to have it all ready and make sure I'm not missing anything. After this, I installed Homebrew and used it to install python3 and I noticed it said
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
rm '/usr/local/bin/2to3'
To force the link and overwrite all conflicting files:
brew link --overwrite python
To list all files that would be deleted:
brew link --overwrite --dry-run python
Possible conflicting files are:
/usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/2to3
/usr/local/bin/2to3-3.7 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/2to3-3.7
/usr/local/bin/idle3 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/idle3
/usr/local/bin/idle3.7 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/idle3.7
/usr/local/bin/pydoc3 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/pydoc3
/usr/local/bin/pydoc3.7 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/pydoc3.7
/usr/local/bin/python3 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
/usr/local/bin/python3-config -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3-config
/usr/local/bin/python3.7 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
/usr/local/bin/python3.7-config -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7-config
/usr/local/bin/python3.7m -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m
/usr/local/bin/python3.7m-config -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m-config
/usr/local/bin/pyvenv -> /Library/Frameworks/Python.framework/Versions/3.7/bin/pyvenv
/usr/local/bin/pyvenv-3.7 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/pyvenv-3.7
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> Caveats
Python has been installed as
/usr/local/bin/python3
So after it, I still ran
MacBook-Air:~ maria$ pip --version
-bash: pip: command not found
MacBook-Air:~ maria$ python -m ensurepip --default-pip
With the result
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
plus one last time
MacBook-Air:~ maria$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
but again got
Installing collected packages: pip, wheel
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
Consider using the `--user` option or check the permissions.
So, ended up doing the deprecated sudo easy_install pip
MacBook-Air:~ maria$ pip --version
pip 19.0.3 from /Library/Python/2.7/site-packages/pip-19.0.3-py2.7.egg/pip (python 2.7)
MacBook-Air:~ maria$ python3 -m ensurepip --default-pip
Looking in links: /var/folders/gj/g8j11snx2ll5xswmw_3696080000gn/T/tmpilb3zgrc
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (40.8.0)
Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (19.0.3)
against all my fears of messing something up but that worked, ironically. The problem is I can't do venvs because I get the [Errno 13] Permission denied
and I'm not sure I want to keep on experimenting and mess it up for real.
Lastly did pip install --user pipenv
which said to have be worked successfully with some notes.
Installing collected packages: virtualenv-clone, enum34, typing, certifi, virtualenv, setuptools, pipenv
The script virtualenv-clone is installed in '/Users/maria/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script virtualenv is installed in '/Users/maria/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The scripts pipenv and pipenv-resolver are installed in '/Users/maria/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed certifi-2019.3.9 enum34-1.1.6 pipenv-2018.11.26 setuptools-41.0.0 typing-3.6.6 virtualenv-16.4.3 virtualenv-clone-0.5.3
And I'm not sure how to proceed from here. If I installed everything correctly, if I can start now or do I need to undo something, etc. I tried the most I could possibly do before nagging anyone. I'm willing to uninstall everything and do it again from 0.