简体   繁体   中英

While installing python package using conda, an error occurred without updating

This is an error I found while installing a python package started with flask using conda. How to fix it?

I've seen a number of workarounds, but it doesn't work, so I'm posting a question.

Anaconda information.

 populated config files : C:\Users\MSI\.condarc
          conda version : 4.12.0
    conda-build version : 3.21.6
         python version : 3.9.7.final.0
       virtual packages : __cuda=11.6=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\MSI\anaconda3  (writable)
      conda av data dir : C:\Users\MSI\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\MSI\anaconda3\pkgs
                          C:\Users\MSI\.conda\pkgs
                          C:\Users\MSI\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\MSI\anaconda3\envs
                          C:\Users\MSI\.conda\envs
                          C:\Users\MSI\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.12.0 requests/2.26.0 CPython/3.9.7 Windows/10 Windows/10.0.19044
          administrator : False
             netrc file : None
           offline mode : False

If you run the following command

conda env update -f environments-windows.yml

The following text is output.

Collecting package metadata (repodata.json): done
Solving environment: | 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.

....

Examining conflict for requests brotlipy urllib3:  90%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉                       | 61/68 [00:11<00:00, 23.41it/s]-
failed                                                                                                                                                                                                                                                                                                               | 

UnsatisfiableError: The following specifications were found to be incompatible with a past
explicit spec that is not an explicit spec in this operation (wheel):

  - alembic==1.6.3=pyhd8ed1ab_0 -> python[version='>=3.6'] -> openssl[version='>=1.1.1a,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1e,<1.1.2a|>=1.1.1f,<1.1.2a|>=1.1.1g,<1.1.2a|>=1.1.1h,<1.1.2a|>=1.1.1i,<1.1.2a|>=1.1.1j,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1l,<1.1.2a|>=1.1.1n,<1.1.2a|>=3.0.2,<4.0a0|>=3.0.0,<4.0a0|>=1.1.1c,<1.1.2a
|>=1.1.1b,<1.1.2a']
  - alembic==1.6.3=pyhd8ed1ab_0 -> python[version='>=3.6'] -> pip
  - alembic==1.6.3=pyhd8ed1ab_0 -> python[version='>=3.6'] -> python_abi[version='2.7.*|3.10.*|3.7.*|3.7|3.8|3.9|3.9.*|3.8.*|3.6.*',build='*_cp27m|*_cp38|*_cp37m|*_pypy39_pp73|*_pypy38_pp73|*_pypy37_pp73|*_cp39|*_cp310|*_cp36m']

...

Package importlib_resources conflicts for:
flask-restx=0.4.0 -> jsonschema -> importlib_resources[version='>=1.4.0']
flask-migrate==2.4.0=py38h32f6830_1 -> alembic[version='>=0.6'] -> importlib_resources
Note that strict channel priority may have removed packages required for satisfiability.

yml file.

name: analytics-observer
channels:
  - conda-forge
  - defaults
dependencies:
  - alembic=1.6.3=pyhd8ed1ab_0
  - aniso8601=9.0.1=pyhd8ed1ab_0
  - attrs=21.2.0=pyhd8ed1ab_0
  - brotlipy=0.7.0=py38h294d835_1001
  - ca-certificates=2020.12.5=h5b45459_0
  - certifi=2020.12.5=py38haa244fe_1
  - cffi=1.14.5=py38hd8c33c5_0
  - chardet=4.0.0=py38haa244fe_1
  - click=8.0.1=py38haa244fe_0
  - colorama=0.4.4=pyh9f0ad1d_0
  - cryptography=3.4.7=py38hd7da0ea_0
  - dataclasses=0.8=pyhc8e2a94_1
  - dnspython=2.0.0=py_0
  - environs=9.3.2=pyhd8ed1ab_0
  - flask=1.1.2=pyh9f0ad1d_0
  - flask-caching=1.7.1=py_0
  - flask-cors=3.0.8=py_0
  - flask-migrate=2.4.0=py38h32f6830_1
  - flask-restx=0.4.0
  - flask-sqlalchemy=2.5.1=pyhd8ed1ab_0
  - greenlet=1.1.0=py38h885f38d_0
  - idna=2.10=pyh9f0ad1d_0
  - importlib-metadata=4.0.1=py38haa244fe_0
  - itsdangerous=2.0.1=pyhd8ed1ab_0
  - jinja2=3.0.1=pyhd8ed1ab_0
  - jsonschema=3.2.0=pyhd8ed1ab_3
  - libprotobuf=3.16.0=h7755175_0
  - lz4-c=1.9.3=h8ffe710_0
  - mako=1.1.4=pyh44b312d_0
  - markupsafe=2.0.1=py38h294d835_0
  - marshmallow=3.12.1=pyhd8ed1ab_0
  - mysql-common=8.0.25=h57928b3_1
  - mysql-connector-python=8.0.25=py38h9bcd702_0
  - mysql-libs=8.0.25=h2a10a4f_1
  - openssl=1.1.1k=h8ffe710_0
  - pip=21.1.2=pyhd8ed1ab_0
  - protobuf=3.16.0=py38h885f38d_0
  - pycparser=2.20=pyh9f0ad1d_2
  - pyopenssl=20.0.1=pyhd8ed1ab_0
  - pyrsistent=0.17.3=py38h294d835_2
  - pysocks=1.7.1=py38haa244fe_3
  - python=3.8.10=h7840368_1_cpython
  - python-dateutil=2.8.1=py_0
  - python-dotenv=0.17.1
  - python-editor=1.0.4=py_0
  - python_abi=3.8=1_cp38
  - pytz=2021.1=pyhd8ed1ab_0
  - redis-py=3.5.3=pyh9f0ad1d_0
  - requests=2.25.1
  - setuptools=49.6.0=py38haa244fe_3
  - six=1.16.0=pyh6c4a22f_0
  - sqlalchemy=1.4.15
  - sqlite=3.35.5=h8ffe710_0
  - urllib3=1.26.4=pyhd8ed1ab_0
  - vc=14.2=hb210afc_4
  - vs2015_runtime=14.28.29325=h5e1d092_4
  - werkzeug=1.0.1=pyh9f0ad1d_0
  - wheel=0.36.2=pyhd3deb0d_0
  - win_inet_pton=1.1.0=py38haa244fe_2
  - wincertstore=0.2=py38haa244fe_1006
  - xz=5.2.5=h62dcd97_1
  - zipp=3.4.1=pyhd8ed1ab_0
  - zlib=1.2.11=h62dcd97_1010
  - zstd=1.5.0=h6255e5f_0

Why doesn't env update work properly? Python version seems to be correct.

It's recommended that you create a new, clean environment and conda install into that.

This can be done as follows:

Create new environment

conda create --name type_any_name_here

  • example:conda create --name new_age

Activate new environment

conda activate type_any_name_here

  • example:conda activate new_age

Install packages into new environment

  • example:conda install pandas

It's a good idea to keep various environments for different projects. You can then use conda deactivate/conda activate and install any packages into the correct environment.

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