简体   繁体   中英

ERROR: Failed building wheel for pycryptodome

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?

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 :

  1. Search for pycryptodome in anaconda packages repo

    conda search pycryptodome

    pycryptodome is available in anaconda repo .

  2. 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

  3. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM