Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug report] Cannot update root environment from Python 2 to Python 3 #7184

Closed
daravi opened this issue Apr 18, 2018 · 7 comments · Fixed by #7719
Closed

[bug report] Cannot update root environment from Python 2 to Python 3 #7184

daravi opened this issue Apr 18, 2018 · 7 comments · Fixed by #7719
Labels
locked [bot] locked due to inactivity severity::2 critical; broken functionality with an unacceptably complex workaround solver pertains to the solver source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type

Comments

@daravi
Copy link

daravi commented Apr 18, 2018

I am submitting a bug report. [IMO]

Steps to Reproduce

Trying to update the current conda root environment from Python 2 to Python 3 results in the following error:

UnsatisfiableError: The following specifications were found to be in conflict:
  - enum34
  - pysocks
  - python=3

Trying to remove pysocks or enum34 results in the following error:

Preparing transaction: done
Verifying transaction: failed

RemoveError: This operation will remove conda without replacing it with
another version of conda.

Expected Behavior

This means that there is no standard method for me to update from Python 2 to Python 3. Correct behaviour would be to allow for the upgrade by offering the option to remove the conflicting packages.

Environment Information

`conda info`

Variable Value
active environment None
user config file /Users/puya/.condarc
populated config files
conda version 4.5.1
conda-build version not installed
python version 2.7.14.final.0
base environment /usr/local/miniconda3 (writable)
channel URLs https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/osx-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/osx-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache /usr/local/miniconda3/pkgs
/Users/puya/.conda/pkgs
envs directories /usr/local/miniconda3/envs
/Users/puya/.conda/envs
platform osx-64
user-agent conda/4.5.1 requests/2.18.4 CPython/2.7.14 Darwin/17.5.0 OSX/10.13.4
UID:GID 501:20
netrc file None
offline mode False

`conda config --show-sources`

$

`conda list --show-channel-url`

Name Version Build Channel
asn1crypto 0.24.0 py27_0 defaults
ca-certificates 2018.03.07 0 defaults
certifi 2018.1.18 py27_0 defaults
cffi 1.11.5 py27h342bebf_0 defaults
chardet 3.0.4 py27h2842e91_1 defaults
conda 4.5.1 py27_0 defaults
conda-env 2.6.0 h36134e3_0 defaults
cryptography 2.2.2 py27h1de35cc_0 defaults
enum34 1.1.6 py27hf475452_1 defaults
futures 3.2.0 py27h1b80678_0 defaults
idna 2.6 py27hedea723_1 defaults
ipaddress 1.0.22 py27_0 defaults
libcxx 4.0.1 h579ed51_0 defaults
libcxxabi 4.0.1 hebd6815_0 defaults
libedit 3.1 hb4e282d_0 defaults
libffi 3.2.1 h475c297_4 defaults
ncurses 6.0 hd04f020_2 defaults
openssl 1.0.2o h26aff7b_0 defaults
pip 9.0.3 py27_0 defaults
pycosat 0.6.3 py27h6c51c7e_0 defaults
pycparser 2.18 py27h0d28d88_1 defaults
pyopenssl 17.5.0 py27hfda213f_0 defaults
pysocks 1.6.8 py27_0 defaults
python 2.7.14 h138c1fe_31 defaults
python.app 2 py27hf2d5e94_7 defaults
readline 7.0 hc1231fa_4 defaults
requests 2.18.4 py27h9b2b37c_1 defaults
ruamel_yaml 0.15.35 py27h1de35cc_1 defaults
setuptools 39.0.1 py27_0 defaults
six 1.11.0 py27h7252ba3_1 defaults
sqlite 3.22.0 h3efe00b_0 defaults
tk 8.6.7 h35a86e2_3 defaults
urllib3 1.22 py27hc3787e9_0 defaults
virtualenv 15.2.0 py27_0 defaults
wheel 0.31.0 py27_0 defaults
xz 5.2.3 h0278029_2 defaults
yaml 0.1.7 hc338f04_2 defaults
zlib 1.2.11 hf3cbc9b_2 defaults

@trianta2
Copy link

I also want to be able to update the root Python version. My use case is that I want to use Miniconda to create a Python environment for a Docker image. However I don't want to install 2 versions of Python - the root Python version and the exact version of Python I need in another environment. That's a waste of space.

@kalefranz
Copy link
Contributor

kalefranz commented Jul 31, 2018

I am able to reproduce, and I also consider this a bug.

$ docker run --rm -it continuumio/miniconda2 conda info

     active environment : None
       user config file : /root/.condarc
 populated config files :
          conda version : 4.5.4
    conda-build version : not installed
         python version : 2.7.15.final.0
       base environment : /opt/conda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/2.7.15 Linux/4.9.93-linuxkit-aufs debian/9 glibc/2.24
                UID:GID : 0:0
             netrc file : None
           offline mode : False

$ docker run --rm -it continuumio/miniconda2 conda install python=3
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - enum34
  - pysocks
  - python=3
Use "conda info <package>" to see the dependencies for each package.

@kalefranz kalefranz added type::bug describes erroneous operation, use severity::* to classify the type solver pertains to the solver source::community catch-all for issues filed by community members severity::2 critical; broken functionality with an unacceptably complex workaround labels Jul 31, 2018
@kalefranz
Copy link
Contributor

@trianta2

However I don't want to install 2 versions of Python - the root Python version and the exact version of Python I need in another environment.

The way I understand your statement, what you want to achieve is technically impossible. You want two different versions of python in your container, but you don't want to install two different versions of python?

@trianta2
Copy link

@kalefranz No, that is not correct. I want the root version of Python to be the exact version of Python I need.

For example, let's say I wanted Anaconda and Python 3.4.3 for a particular application that I wanted to build a Docker image for. Just now I installed a new Miniconda distribution, which gave me Python 3.6.5. I tried to change the root Python version:

$ conda env list
# conda environments:
#
base                  *  <basedir>/mini

$ which python
<basedir>/mini/bin/python

$ python --version
Python 3.6.5 :: Anaconda, Inc.

$ conda install python=3.4.3
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - python=3.4.3
  - urllib3 -> ipaddress -> python[version='>=2.7,<2.8.0a0'] -> readline=7
  - urllib3 -> ipaddress -> python[version='>=2.7,<2.8.0a0'] -> tk=8.6
Use "conda info <package>" to see the dependencies for each package.

Since this is not possible, the alternative solution is to create another Python environment with python=3.4.3. This leaves me with 2 versions of Python, one that I don't want (3.6.5) and one that I do want (3.4.3), which is a waste of space.

@kalefranz
Copy link
Contributor

Ok, then yes, I think the problems are related. In your case conda isn't scheduling packages for removal to facilitate the requests rebundling of dependencies you get when downgrading to requests built for python 3.4.

@kalefranz
Copy link
Contributor

The block of code that's supposed to be taking care of this here is

conda/conda/core/solve.py

Lines 346 to 360 in 9f3072c

# We've previously checked `solution` for consistency (which at that point was the
# pre-solve state of the environment). Now we check our compiled set of
# `final_environment_specs` for the possibility of a solution. If there are conflicts,
# we can often avoid them by neutering specs that have a target (e.g. removing version
# constraint) and also making them optional. The result here will be less cases of
# `UnsatisfiableError` handed to users, at the cost of more packages being modified
# or removed from the environment.
conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs))
if log.isEnabledFor(DEBUG):
log.debug("conflicting specs: %s", dashlist(conflicting_specs))
for spec in conflicting_specs:
if spec.target:
final_environment_specs.remove(spec)
neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True)
final_environment_specs.add(neutered_spec)

It's apparently insufficient in this case.

@github-actions
Copy link

github-actions bot commented Sep 8, 2021

Hi there, thank you for your contribution to Conda!

This issue has been automatically locked since it has not had recent activity after it was closed.

Please open a new issue if needed.

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Sep 8, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity severity::2 critical; broken functionality with an unacceptably complex workaround solver pertains to the solver source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants