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

Conda installation in a Python 3 environment doesn't work #1446

Closed
khinsen opened this issue Jun 29, 2017 · 14 comments
Closed

Conda installation in a Python 3 environment doesn't work #1446

khinsen opened this issue Jun 29, 2017 · 14 comments

Comments

@khinsen
Copy link

khinsen commented Jun 29, 2017

Expected behaviour

conda install mdanalysis should create a working installation of MDAnalysis, or else report an error.

Actual behaviour

When run in a Python 3 conda environment, conda install mdanalysis installs a Python 2 version of MDAnalysis (under lib/python2.7). It does not install Python 2, so the installation is unusable.

Note that the installation instructions nowhere mention if MDAnalysis expects Python 2 or Python 3, so it is certainly not unreasonable to try a conda installation for Python 3.

@kain88-de
Copy link
Member

@khinsen we don't have python 3 packages right now. In fact MDAnalysis only has experimental python 3 support right now. We are working on getting full python 3 support this summer.

Until then you have to install MDAnalysis from pip on python3. But be warned that some things might not work.

I'm a bit surprised though that conda just installed the python2 package. Did you install from the conda-forge channel?

@khinsen
Copy link
Author

khinsen commented Jun 29, 2017

Yes. I understand that MDAnalysis has incomplete Python 3 support for now (although it takes a while to figure this out). And then it makes sense not to have a Python 3 conda package. But then I expect one of (1) an error message or (2) an automatic installation of Python 2 as a dependency, with a preference for (1).

@kain88-de
Copy link
Member

Did you install MDAnalysis from the conda-forge channel?

@kain88-de
Copy link
Member

What does conda config --show return for you?

@orbeckst
Copy link
Member

I can confirm: In an anaconda3 environment, conda will happily install a non-functional MDAnalysis.

Package plan for installation in environment /Users/oliver/anaconda3:

The following NEW packages will be INSTALLED:

    biopython:       1.68-np112py35_0
    griddataformats: 0.3.3-py35_0      conda-forge
    hdf4:            4.2.12-0          conda-forge
    joblib:          0.11-py35_0       conda-forge
    libnetcdf:       4.4.1.1-4         conda-forge
    mdanalysis:      0.16.2-np112_0    conda-forge
    mmtf-python:     1.0.7-py35_0      conda-forge
    netcdf4:         1.2.8-np112py35_0 conda-forge

However, despite it being installed by conda, it is not importable

Python 3.5.3 |Anaconda 4.4.0 (x86_64)| (default, Mar  6 2017, 12:15:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MDAnalysis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'MDAnalysis'
>>>

and as originally reported, it was installed in anaconda3/lib/python2.7/site-packages/

ls anaconda3/lib/python2.7/site-packages/
MDAnalysis                       MDAnalysis-0.16.2-py2.7.egg-info

@kain88-de , this is my config:

conda config --show

gives

add_anaconda_token: True
add_pip_as_python_dependency: True
allow_non_channel_urls: True
allow_softlinks: True
always_copy: False
always_softlink: False
always_yes: False
anaconda_upload: None
auto_update_conda: True
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: True
channels:
  - conda-forge
  - defaults
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
create_default_packages: []
custom_channels:
  pkgs/r: https://repo.continuum.io/
  pkgs/free: https://repo.continuum.io/
  pkgs/pro: https://repo.continuum.io/
custom_multichannels:
  local: []
  defaults: ["https://repo.continuum.io/pkgs/free", "https://repo.continuum.io/pkgs/r", "https://repo.continuum.io/pkgs/pro"]
default_channels:
  - https://repo.continuum.io/pkgs/free
  - https://repo.continuum.io/pkgs/r
  - https://repo.continuum.io/pkgs/pro
disallow: []
envs_dirs:
  - /Users/oliver/anaconda3/envs
  - /Users/oliver/.conda/envs
force: False
json: False
local_repodata_ttl: 1
migrated_channel_aliases: []
offline: False
path_conflict: clobber
pinned_packages: []
pkgs_dirs:
  - /Users/oliver/anaconda3/pkgs
  - /Users/oliver/.conda/pkgs
proxy_servers: {}
quiet: False
remote_connect_timeout_secs: 9.15
remote_max_retries: 3
remote_read_timeout_secs: 60.0
rollback_enabled: True
shortcuts: True
show_channel_urls: None
ssl_verify: True
track_features: []
use_pip: True
verbosity: 0

@orbeckst
Copy link
Member

orbeckst commented Jun 29, 2017

P.S.: I followed our quick-install instructions

conda config --add channels conda-forge
conda install mdanalysis

and the sources

conda config --show-sources
==> /Users/oliver/.condarc <==
channels:
  - conda-forge
  - defaults

@khinsen
Copy link
Author

khinsen commented Jun 30, 2017

Here is my conda configuration:

(root) ~/ $ conda config --show
add_anaconda_token: True
add_pip_as_python_dependency: True
allow_non_channel_urls: True
allow_softlinks: True
always_copy: False
always_softlink: False
always_yes: False
anaconda_upload: None
auto_update_conda: True
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: True
channels:
  - conda-forge
  - defaults
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
create_default_packages: []
custom_channels:
  pkgs/r: https://repo.continuum.io/
  pkgs/free: https://repo.continuum.io/
  pkgs/pro: https://repo.continuum.io/
custom_multichannels:
  defaults: ["https://repo.continuum.io/pkgs/free", "https://repo.continuum.io/pkgs/r", "https://repo.continuum.io/pkgs/pro"]
  local: []
default_channels:
  - https://repo.continuum.io/pkgs/free
  - https://repo.continuum.io/pkgs/r
  - https://repo.continuum.io/pkgs/pro
disallow: []
envs_dirs:
  - /Users/hinsen/anaconda3/envs
  - /Users/hinsen/.conda/envs
force: False
json: False
local_repodata_ttl: 1
migrated_channel_aliases: []
offline: False
path_conflict: clobber
pinned_packages: []
pkgs_dirs:
  - /Users/hinsen/anaconda3/pkgs
  - /Users/hinsen/.conda/pkgs
proxy_servers: {}
quiet: False
remote_connect_timeout_secs: 9.15
remote_max_retries: 3
remote_read_timeout_secs: 60.0
rollback_enabled: True
shortcuts: True
show_channel_urls: None
ssl_verify: True
track_features: []
use_pip: True
verbosity: 0

@kain88-de
Copy link
Member

The conda packages are now not installable on python 3 anymore

@goanpeca
Copy link

This seems to be still a problem for packages on conda-forge.

Any way I can help?

Cheers

@orbeckst
Copy link
Member

orbeckst commented May 29, 2019

@goanpeca can you check which version of the conda package gets installed? EDIT: ... and where?

@kain88-de had fixed the problem conda-forge/mdanalysis-feedstock#4 (comment) but I actually don't remember how (probably conda-forge/mdanalysis-feedstock@3b8efbb); we now certainly have the python run time dependency which – to my limited understanding – should ensure that only matching versions of Python should be installed.

@goanpeca
Copy link

I will check this next week ;-)

I tried this installation over two months ago and it was not working (this issue was also closed by that time, but the error was identical using conda-forge)

@goanpeca
Copy link

goanpeca commented May 29, 2019

@orbeckst

$ conda create -n mda mdanalysis python=3.7 -c conda-forge
$ conda activate mda
$ python
>>>from MDAnalysis.tests.datafiles import PSF, DCD   # test trajectory

Results in

*** ERROR ***
In order to run the MDAnalysis test cases you must install the
MDAnalysisTestData package (which has been separated from the 
library code itself since release 0.7.4). Go to 

     http://pypi.python.org/pypi/MDAnalysisTests

and download and install the `MDAnalysisTests-x.y.z.tar.gz'
that matches your MDAnalysis release.
Traceback (most recent call last):
  File "/Users/gpena-castellanos/anaconda2/envs/mda/lib/python3.7/site-packages/MDAnalysis/tests/datafiles.py", line 41, in <module>
    from MDAnalysisTests.datafiles import *
ModuleNotFoundError: No module named 'MDAnalysisTests'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gpena-castellanos/anaconda2/envs/mda/lib/python3.7/site-packages/MDAnalysis/tests/datafiles.py", line 52, in <module>
    raise ImportError("MDAnalysisTests package not installed.")
ImportError: MDAnalysisTests package not installed.

Which talks about pip and would confuse users using conda

(BTW before I could not import the package, not sure what changed)

@kain88-de
Copy link
Member

The warning you get is normal. The test files are in a separate package mdanalysistests that has to be installed as well. I agree that the hint to pypi should be changed to the mdanalysis homepage where we link against current installation with pip or conda.

@goanpeca
Copy link

The warning you get is normal.

yep!

Agreed. Will need to test on the system I got the issue with python 3. Glad to see it is working for me now :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants