问题
I was trying to install pycryptodome
, python-jose-cryptodome
using pip
within anaocnda3 environment.
I got this error:
ERROR: Failed building wheel for pycryptodome
I have tried many versions many solutions(latest versions, specified version, with python 3.8 or 3.7, using requirements text without cache and even alone installation) but nothing worked for me :(. Any solution?
回答1:
While using pip
in an anaconda environment is allowed and fine, issues may arise when using pip
and conda
together, this was clearly mentioned in the conda docs.
One of the best practices when installing packages in an anaconda environment is to use conda
for search and install before using pip.
So instead of directly using pip
, try to :
Search for pycryptodome in anaconda packages repo
conda search pycryptodome
pycryptodome is available in anaconda repo .
The next step is to install pycryptodome :
conda install -c anaconda pycryptodome
or if you want to use conda-foge channel :
conda install -c conda-forge pycryptodome
this should get pycryptodome installed into your env
To use a requirements.txt file with conda :
conda install --yes --file requirements.txt
Summary : Best Practices Checklist When Using Pip in a Conda Environment
Use pip only after conda
install as many requirements as possible with conda, then use pip
pip should be run with –upgrade-strategy only-if-needed (the default)
Do not use pip with the –user argument, avoid all “users” installs
Use conda environments for isolation
- create a conda environment to isolate any changes pip makes
- environments take up little space thanks to hard links
- care should be taken to avoid running pip in the “root” environment
Recreate the environment if changes are needed
- once pip has been used conda will be unaware of the changes
- to install additional conda packages it is best to recreate the environment
Store conda and pip requirements in text files
- package requirements can be passed to conda via the –file argument
- pip accepts a list of Python packages with -r or –requirements
- conda env will export or create environments based on a file with conda and pip requirements .
you can read more about this topic here on anaconda website, and on conda docs
来源:https://stackoverflow.com/questions/60713274/error-failed-building-wheel-for-pycryptodome