Docker-stacks: Error while installing package to Python2 and 3 enviroments

Created on 14 Sep 2016  路  6Comments  路  Source: jupyter/docker-stacks

Hi Folks,

I am using this command to install some packages to both Python2 and Python3.
The command run just fine, but in the notebook only python3 env is OK

All packages installed appear on pip list and conda list commands, but the import command inside a python2 notebook is not working.

Any ideas?

# 'Python3'
RUN python -m pip install transitions
RUN python -m pip install git+http://22.22.22.22/user/somepack.git

# 'Switch to Python2 and install it again'
RUN source activate python2

# 'Python2'
RUN python -m pip install transitions
RUN python -m pip install git+http://22.22.22.22/user/somepack.git

# 'Switch back to default Python3'
RUN source deactivate`

Question

All 6 comments

problem only happens with "somepack" library that is installed directly from git

This step:

# 'Switch to Python2 and install it again'
RUN source activate python2

is not persistent through the following commands. You'll need to add the activation into the same run statement as the pip installs.

Like this?

RUN source activate python2 && \
        python -m pip install transitions  && \
        python -m pip install git+http://22.22.22.22/user/somepack.git

I think that's close to correct. You might need to wrap the whole thing in a bash -c "source activate ..." if that doesn't work.

@guilhermecgs Did you get it working?

Yes, worked perfectly!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

statiksof picture statiksof  路  4Comments

jp68138743541 picture jp68138743541  路  4Comments

romainx picture romainx  路  4Comments

iyanmv picture iyanmv  路  4Comments

iramsey85 picture iramsey85  路  4Comments