Python 3.5 not letting me pip install certain libraries - pip

So I recently upgraded from python 3.4 to 3.5 on my macbook pro. Now when I try to pip install certain libraries I keep getting this error. I have searched and searched and haven't found a solution. Has anyone else had this issue and solved it???
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/1_/vjkc260x25v12hl0d3nrqqwc0000gn/T

Related

Pip could not find a version that satisfies the requirement torch (from versions: none)

I am trying to install PyTorch on my Windows 11. I have Python 3.8.1, and pip 22.2.2. I have tried running the command py -m pip install torch, but it keeps returning the error:
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch
I have gone through various StackOverflow posts and tried many different strategies. I even uninstalled and re-installed pip on my system using the get-pip.py file. Nothing seems to work.
Suggestions?
Just came across another post that mentioned how it needs to be the 64-bit version of Python to allow installation of PyTorch.
Just installed Python 3.9.13 with the 64-bit installer, and the installation worked. So, if anyone else is running into issues, would recommend first running python in command shell and checking whether it is 64 bit or 32 bit.

Message "note: This error originates from a subprocess, and is likely not a problem with pip"

While downloading pip install allennlp==1.0.0 allennlp-models==1.0.0, I faced this problem:
[6 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
building 'srsly.msgpack._unpacker' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for srsly
Failed to build thinc blis srsly
ERROR: Could not build wheels for srsly, which is required to install pyproject.toml-based projects
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I have downloaded:
pip install -vvv torch
pip install numpy
pip3 install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
and it still not working.
I am using Python 3.10.2 on Windows 11 Pro.
What should I do?
I had Python 3.10 and had the same error installing psutil from pip. I fixed the problem by installing an older version of pip using the command:
pip install pip==21.3.1
You have to install the Python 3.9.10 version from python.org and after installation, upgrade your pip and everything will be sorted.
It is the problem in Python 3.10.2... This method is working. I was suffering from the same problem in installing the turtle, so I did that and error was solved.
This particular error is caused by not having a C/C++ compiler installed. As said in the error message, either install MSVC or another compiler to compile it.
Please read your error messages; they are there for a reason.
If you're using a Python 3 image, this might help:
RUN apk update
RUN apk add make automake gcc g++ subversion python3-dev
Reference from Problems with pip install numpy - RuntimeError: Broken toolchain: cannot link a simple C program
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Download and install or update
Microsoft Visual C++ 14.0 or greater is required.
You must be install build visual tools 15, 17, 19, or greater.
Download from Microsoft C++ Build Tools.
To solve this problem, you need to download Visual Studio from its main page.
If Visual Studio is already installed, then when you run the installer, you can modify it (by clicking the modify button):
During Visual Studio installation (or installation modification) choose Desktop Development with C++:
First: You installed the Mingw-w64 compiler with a full MSYS2 package, and this package included Python.
Second: you get the error because the plugin is not in the Python packages installed by MSYS2.
So: uninstall MSYS2 and install a minimalistic MinGW (MinGW - minimalistic GNU for Windows).
And finally Install a version of Python from the official Python page.
Now if you can install plugins.
I've found a similar question from GitHub, and credits goes to thaibee. Here I quote:
It's a problem with Microsoft products and is
very easy to solve.
If you can't install these plugins as well,
need to download it from other repositories like this one:
https://www.lfd.uci.edu/~gohlke/pythonlibs/ depends on the version of python and the system.
For example: for my Windows 11 (x64) and Python 3.10 I took this file: pyodbc‑4.0.32‑cp310‑cp310‑win_amd64.whl
It's very easy to install: pip install pyodbc‑4.0.32‑cp310‑cp310‑win_amd64.whl
After it, the system works well and didn't ask you about VC.
This solution I found in problem with the MySQL plugin for Django. I don't understand why - but they also use VC for the installation process.
I understand your problem, and I have faced it too. I tried multiple solutions, but it didn't work, so I simply uninstalled my Python and installed some older version of it. Example: I recently uninstalled Python 3.10.2 and installed 3.9.10.
It worked without any errors.
I had a similar problem while installing with pip3: building wheel for box2d-py (setup.py) ... error
The solution was just to install SWIG prior to box2d, so I added the following steps manually:
pip install swig
pip install gym[box2d]
For Mac, there is a possible workaround for this problem if you use Conda. The idea is to create an x86 environment on the Mac and do your pip install after that.
conda create -n <name>
conda activate <name>
conda config --env --set subdir osx-64
conda install python=3.8
Here I choose Python 3.8, but you can choose another version.
If you are on macOS (maybe Apple silicon) then first try to do this from your base location of the terminal:
eval "$(/opt/homebrew/bin/brew shellenv)"
Then, do brew update and brew upgrade.
Once you are done with that, type
brew install geos
Now again go to your virtual environment and activate it (if you are working in the virtualenv) and then type:
python3.10 -m pip3 install [module name]
I was facing the same problem when executing:
python -m pip install package-name
After many failed tentatives, what fixed the problem for me was executing:
py -m pip install package-name
When I type py in the terminal, it shows this information:
Python 3.9.8 (tags/v3.9.8:bb3fdcf, Nov 5 2021, 20:48:33) [MSC v.1929 64 bit (AMD64)] on win32
When I type python in the terminal, it shows this information:
Python 3.8.2 (default, Apr 9 2020, 13:17:39) [GCC 9.3.0 64 bit (AMD64)] on win32
I believe that this problem is related to the Python interpreter version.
I tried all recommendations that were written, but none worked. My Python was 3.11.
So I just installed Python 3.8.10 from here:
https://www.python.org/downloads/release/python-3810/
And ran
C:\Python38\python.exe -m pip install matplotlib
And it worked.
I faced a similar problem while installing pandas-datareader.
I was using Python 3.11.0, and after trying all possible solutions, I downloaded Python 9.10.0 and it worked fine.
We can install DVC with the below commands:
conda install -c conda-forge mamba # installs much faster than conda
mamba install -c conda-forge dvc
For more information please refer this: https://dvc.org/doc/install/

AllenNLP Torch Version Unavailable

I am trying to install allennlp via pip on the latest version of macOS Catalina. The Python version is 3.9.0. The pip version is 20.2.4.
I was just able to install only a couple of weeks ago, but now I receive the following error when I run the command:
pip3 install allennlp allennlp-models
ERROR: No matching distribution found for torch<1.8.0,>=1.6.0 (from allennlp)
This is really bad because a time-sensitive project I am working on right now completely depends on allennlp working. I needed to reinstall due to some git issues, and my virtual env was reset. What can I do to resolve this issue?
Thanks.
EDIT: Somehow I ended up uninstalling 3.9 in homebrew and now I'm stuck at jsonnet. It errors out. I saw some posts about this issue, but none of the recommendations work.
EDIT2: I tried reinstalling brew's python 3.9. jsonnet standalone works again, but then I have the pytorch issue again.
I'm stuck in a loop. Neither the system macOS 3.8 python nor the latest 3.9 home-brew python works. I'd rather get the home-brew python working, but there's no valid version of torch available for that one apparently.
Do NOT accidentally use home-brew to download the latest Python 3.9. That isn't compatible with a lot of the required libraries.
Phew.

Cannot Install dlib and OpenCV together in Anaconda for required python-versions' mismatch

I am trying to develop a system that requires OpenCV and dlib to be installed in anaconda to work with. I tried a lot to install dlib package in latest anaconda (Anaconda3-2019.03-Windows-x86_64) distribution. But it says to downgrade the python version. Again I also found the dlib package does not still support python3.7. See here the available versions:
https://pypi.org/simple/dlib/
Than I created a virtual environment having python3.6. But I faced another type of error. It cannot play video file (mp4). But it works fine if the video is taken from webcam. It shows the following error:
gray=cv.cvtColor(frame,cv.COLOR_BGR2GRAY) error: ..\..\..\modules\imgproc\src\color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
As I found this error occurs when it doesn't find any video file. But in my case there is no reason of not finding a video file. I tried both by using video file name (keeping it in the same folder) and full path as well. It behaves the same.
Than I installed Anaconda3 (5.0.1) which comes with python3.6 which should work fine but I failed to install OpenCV using command:
conda install -c conda-forge OpenCV
It says:
CondaError: Cannot link a source that does not exist. C:\Users\Username\Anaconda3\Scripts\conda.exeRunning `conda clean --packages` may resolve your problem.
It throws the same error even if I try to install OpenCV after cleaning conda packeges.
With which versions of these navigator, python, OpenCV and dlib I can make a stable working environment for my work and how?
Summarizing what I want:
A stable anaconda installation
Can work with dlib and OpenCV libraries
No problem in working with video files. No matter it comes from
webcam or other saved video.
Please help me :(
Well I solved this problem myself. These are what I did:
Removing existing Anaconda distribution "Completely". Follow
instructions from here:
https://docs.anaconda.com/anaconda/install/uninstall/
Installing Anaconda3 5.2.0 from here (this version comes with python
3.6.5 that satisfies the requirements):
https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe
Installing OpenCV from Anaconda prompt. See here:
https://anaconda.org/conda-forge/opencv
Installing dlib (19.7.0) from Anaconda prompt using this command:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Done!
NB:
Here I got some of the steps from the following posts:
For uninstalling Anaconda I found the solution from: How to remove anaconda from windows completely? | Answered by: Jakob
For installing dlib I found the solution from: dlib installation on Windows 10 | Answered by: Marco D.G.
I am thankful to them as well.

Python: No Pip after installing latest version

After not being able to use pip getting an "invalid syntax" error when entering "python pip" in the CMD-Line of windows, I downloaded the latest python package from the website and installed it.
But same problem.
Even in the Python folder there is neither a pip.py nor a "get-pip.py". That's pretty weird.
What could be the reason?

Resources