Over time, I've managed to "accumulate" various versions of Python on my Mac. Most are there due to either being part of the OS, or being installed as part of another "solution" that has a dependency on Python. IN effect, I now have Python 2.6, 3.6 and 3.7 on my system, and it seems pip is somehow linked to 3.7, while pip3 is somehow linked to 3.6.
How can I safely remove all Python versions and only have the latest running and correctly "linked" with things like pip?
Perhaps I should have added the reason why I'm posting this question today, even though the "mess" with all the versions have been haunting me for a while now.
One of my scripts requires requests, and when I try to use it against an SSL URL, I get the infamous "ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)" error. No matter what I try (update/install certifi or running the Install Certificates.command) - my script keeps failing here and I suspect it simply because running the command or updating certifi is NOT changing the "running" python...
You can check out this Stack Overflow thread to help you locate/delete your python versions.
It is very common/normal to have multiple python versions on your system they just have to be setup correctly.
I would highly recommend using pyenv to manage multiple verions of python and it makes switching between them really easy (both locally and globally) and use it in combination with a virtual environment per project you are working on.
Related
I've run into some problems while trying to download packages with pip. Namely, when I run
pip install "dask[complete]"
on MacOS Catalina 10.15.7. Specifically, the package that throws this error is psutil.
I run into an #error: architecture not supported message. I believe this is because the installer is looking for the MacOS 10.14.6 SDKs, but I am on 10.15.7. One user on this post stated that installing a new Python 3 fixed the issue. Maybe this is because the newer Python comes with a cached version of the package that uses the MacOS 10.15.7 SDKs.
I'm guessing that there might be two solutions to this issue:
Download a non-cached version of psutil, which might be compatible with the version of Python I'm using as well as MacOS Catalina.
Download a newer version of Python 3, namely 3.8.5+, and replace the Xcode Python 3 with this version, enabling me to stay up-to-date with current Python and packages.
I'm wary of the second method because of any possible dependencies I will lose while updating, and I've also been made very aware through research that generally speaking, you don't want to mess with system Python installations.
I'm not opposed to being walked through the first solution, if it would indeed solve the problem, but am very curious about the second solution, again, if it is possible. If neither approach would work out as intended, has anyone encountered this issue and resolved it without using a fresh, SEPARATE install of Python? I don't really want to start messing with virtual environments, but if I must, I supposed I will just download PyCharm and restart there.
EDIT: After continuing to try to work around the issue, I've been led to believe that it is not being caused by an outdated version of psutil; could it be an outdated version of setup.py? In this case, would it indeed be an issue with an old Python version? I'm very new to configuring Python in depth like this, any help would be greatly appreciated.
Try setting the environment variable ARCHFLAGS="-arch x86_64" so Xcode 12 doesn't try to build an ARM64 universal binary. It worked for me on a different python package that had the same error.
ARCHFLAGS="-arch x86_64" pip install "dask[complete]"
(Thanks to Keith Smiley's comment at on Bitbucket for pointing this out.)
I am having trouble installing a few modules on my Windows computer (namely TensorFlow). I used to have Python 3.5 and 3.7 installed on this computer, but have since uninstalled Python 3.5 through the Control Panel. However, when I try to check the version of PIP, I get the following error:
Fatal error in launcher: Unable to create process using '"c:\users\yoonh\appdata\local\programs\python\python35\python.exe" "C:\Users\yoonh\appdata\local\programs\python\python35\Scripts\pip.exe" --version'
Meanwhile, following other instructions and using py -m pip ... gives me the following error:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
I would really appreciate if someone could help me solve this issue! Thank you!
From the information you provided, it looks like you still have Python 3.5 installed for your account locally, or some leftovers from it.
First, if you just uninstalled Python 3.5, make sure that you closed and restarted your command prompt from the Start Menu after uninstalling Python. To be extra sure, restart your system just to ensure that the uninstallation is fully complete (it may not be if e.g. some files from it were in use while you were uninstalling. Windows Installer tells you if this happens and that you need to restart but many users have a bad habit of not reading warnings.).
Run appwiz.cpl as yourself (without elevation) and uninstall Python 3.5 if present
Delete c:\users\yoonh\appdata\local\programs\python\python35 and anything under it; delete it from PATH, too, if present (run SystemPropertiesAdvanced -> "Environment variables")
Check the registry at HKCU\Software\Python\PythonCore and HKCU\Software\Wow6432Node\Python\PythonCore and same under HKLM for any subkeys pointing to installations that don't actually exist
Environment: Windows 7, Windows 10. 32 bits Python 2.7.9, 32 bits Python 3.4.2.
Issue: A couple python packages, notably ipython and nose, when uninstalled using e.g. "pip uninstall nose" also deletes the C:\Python27 / C:\Python34 link. Lots of tasks make use of these links, and fail to access any Python tool after the uninstall.
This happens consistently under either Windows 7 or Windows 10, under Python 2.7.9 or Python 3.4.2, with nose 1.3.4 or 1.3.7.
The behaviour is identical across a couple dozen different machines of highly various ages, both desktop machines and build agents.
Uninstalling ipython behaves the same way as uninstalling nose. Other packages uninstall without any such problems.
I am not myself doing Python development, but maintain a build environment for several projects using various tool versions. So, unistalling a Python package of one version to make room for another version is an everyday affair: On our build agents, a package of another version could (in principle) be installed for every build job executed. So we are completely dependent on automatic (i.e. scripted) and silent uninstall of the old version and install of the new one. No manual operations to clean up, reinstating the deleted link, is possible.
Any hints about how to handle this?
If anyone can give an explanation of WHY this happens, I'd be very curious!
It seems that I cannot get yowsup properly installed under Windows 7.
I am following these procedures for installation:
https://github.com/tgalal/yowsup/blob/master/README.md
doing a
pip install yowsup2
python setup.py install
I have omitted installation of zlib since I do know where the dll is,
but not in which directory I should copy it.
Everything runs fine when using yowsup-cli, I can send and receive messages.
However, I cannot run samples on signals and methods such as shown:
https://github.com/tgalal/yowsup/wiki/%5BLegacy%5D-Yowsup-Documentation
since I cannot find the file connectionmanager.py, this is not installed or created.
Any help appreciated, thanks!
There are two branches: legacy (yowsup) and master (yowsup2)
Yowsup2 is the newer version with a clean up of the code compared to yowsup(legacy).
What you did is installing yowsup2 but you tried to use functions of the legacy package. (Imagine an old car as legacy without automatic but you trying to use it)
Also Yowsup2 (master) will get updates and that stuff while legacy won't be updated anymore.
If you have any more questions feel free to ask.
It seems that one needs to do an additional
pin install Yowsup
(mind the capital letter, and no trailing '2' here)
to install the legacy package which includes the connectionmanager.py
However, this is installed in the directory yowsup starting with a small 'y', but modules in the scripts are still not found since they refer to a Yowsup directory with capital Y.
Confused.
What is the correct way to install and update Python packages on OS X Mountain Lion, using Apple's built in Python?
I've tried all everything I can find here and in the documentation for various packages but keep encountering all kinds of errors that result in failed or aborted installations or updates. Notably, with pip I frequently get errors like
RuntimeError: maximum recursion depth exceeded in cmp
or
SError: [Errno 24] Too many open files: '/Library/Python/2.7/site-packages'
and some commands pip commands (like list) just don't seem to exist at all.
I have an uptodate version of pip that works fine with some packages, and have the latest Xcode command line tools installed.
The only thing that seems to work — and it works all the time — is
python setup.py install
Is this the correct way to maintain and install python packages on Lion? Is there any reason not to use this method as my primary method for keeping packages uptodate? Should pip be working for me, or does it not work with Apple's Python?
UPDATE: I spoke too soon. I also have problems with
python setup.py install
Occasionally (often) I'll get:
error: /Library/Python/2.7/site-packages: Too many open files
When nothing is running in a fresh Terminal, I get about 50 when I
lsof | grep python | wc -l
and if I quit Dropbox, which seems to be the source of these, and reduce the number to 0, I still get "Too many open files" for most package installation operations, with whatever tool I use, even after a reboot of my system.
Why am I getting a "too many open files" error so often?
You should be able to maintain exactly as you're doing, but likely need to update your PYTHONPATH to somewhere outside of /Library, hence the reason everyone else is mentioning that and/or using homebrew to install python.
I install python packages with pip and maintain them using:
https://github.com/nvie/pip-tools
First of all, download and install the full Python from the python website.
Then use pip (or homebrew). The built-in python is incomplete in many respects, including mainly, the ability to install new packages. I faced similar problems when I fist got my MacBookPro and installing the full python on top of the built-in one solved all my troubles
Why use Apple's built-in Python? It's incomplete, I think.
I'm using Homebrew and brew install python works fine for me.
From https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python:
We recommend to brew install python because:
Comes with pip (and distribute)
Python (distutils) finds brewed
software (includes, libs), knows about the compiler and flags even if
the command line tools for Xcode are not installed.
No need to set the PYTHONPATH for Homebrew bindings.
No need to work-around the sudo-is-needed-for-easy_install issue