dfm/emcee

issue with emcee installation

shruti-ramaiya opened this issue · 3 comments

  • emcee version: 3.1.4
  • platform: MacOS
  • installation method (pip/conda/source/other?): pip

Problem description:

I am trying to install emcee on MacOS

I follow the exact instructions from the docs,

python -m pip install -U pip pip install -U setuptools setuptools_scm pep517 pip install -U emcee

which tells me emcee installed successfully.

However, also following the doc guidelines, the issue arises when going to test the installation and whether it was successful

To do so, I follow the steps as stated below,

  1. I clone the git repo using git clone https://github.com/dfm/emcee.git which I then cd into the root directory
  2. I then input the following commands into the terminal exactly as written in the docs,

python -m pip install -U pytest h5py python -m pytest -v src/emcee/tests

According to docs, this should return no errors if successful. However in my case, I get the following output in my terminal

`============================= test session starts ==============================
platform darwin -- Python 3.11.5, pytest-8.0.0, pluggy-1.4.0 -- /Users/shrutiramaiya/anaconda3/envs/emcee/bin/python
cachedir: .pytest_cache
rootdir: /Users/shrutiramaiya/Desktop/emceetest/emcee
plugins: anyio-3.5.0
collected 0 items / 15 errors

==================================== ERRORS ====================================
___________ ERROR collecting src/emcee/tests/integration/test_de.py ____________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_de.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
_______ ERROR collecting src/emcee/tests/integration/test_de_snooker.py ________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_de_snooker.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
________ ERROR collecting src/emcee/tests/integration/test_gaussian.py _________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_gaussian.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
___________ ERROR collecting src/emcee/tests/integration/test_kde.py ___________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_kde.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
_______ ERROR collecting src/emcee/tests/integration/test_longdouble.py ________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_longdouble.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
________ ERROR collecting src/emcee/tests/integration/test_proposal.py _________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_proposal.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
_________ ERROR collecting src/emcee/tests/integration/test_stretch.py _________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_stretch.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
__________ ERROR collecting src/emcee/tests/integration/test_walk.py ___________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/integration/test_walk.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
____________ ERROR collecting src/emcee/tests/unit/test_autocorr.py ____________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_autocorr.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
____________ ERROR collecting src/emcee/tests/unit/test_backends.py ____________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_backends.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
_____________ ERROR collecting src/emcee/tests/unit/test_blobs.py ______________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_blobs.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
____________ ERROR collecting src/emcee/tests/unit/test_ensemble.py ____________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_ensemble.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
____________ ERROR collecting src/emcee/tests/unit/test_sampler.py _____________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_sampler.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
_____________ ERROR collecting src/emcee/tests/unit/test_state.py ______________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_state.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
____________ ERROR collecting src/emcee/tests/unit/test_stretch.py _____________
ImportError while importing test module '/Users/shrutiramaiya/Desktop/emceetest/emcee/src/emcee/tests/unit/test_stretch.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../anaconda3/envs/emcee/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
src/emcee/init.py:22: in
from .emcee_version import version # isort:skip
E ModuleNotFoundError: No module named 'emcee.emcee_version'
=========================== short test summary info ============================
ERROR src/emcee/tests/integration/test_de.py
ERROR src/emcee/tests/integration/test_de_snooker.py
ERROR src/emcee/tests/integration/test_gaussian.py
ERROR src/emcee/tests/integration/test_kde.py
ERROR src/emcee/tests/integration/test_longdouble.py
ERROR src/emcee/tests/integration/test_proposal.py
ERROR src/emcee/tests/integration/test_stretch.py
ERROR src/emcee/tests/integration/test_walk.py
ERROR src/emcee/tests/unit/test_autocorr.py
ERROR src/emcee/tests/unit/test_backends.py
ERROR src/emcee/tests/unit/test_blobs.py
ERROR src/emcee/tests/unit/test_ensemble.py
ERROR src/emcee/tests/unit/test_sampler.py
ERROR src/emcee/tests/unit/test_state.py
ERROR src/emcee/tests/unit/test_stretch.py
!!!!!!!!!!!!!!!!!!! Interrupted: 15 errors during collection !!!!!!!!!!!!!!!!!!!
============================== 15 errors in 0.16s ==============================`

I do not understand how to go about solving this as I followed the docs exactly. I have tried this multiple times and to no avail. If anyone could guide me to solving these issues I would appreciate it

Thank you

dfm commented

Thanks for raising this issue. If you want to run the unit tests, you'll need to install from source as explained here: https://emcee.readthedocs.io/en/stable/user/install/#from-source

But, that being said, I don't think there's any reason why you'll need to run the tests when you install using pip. It's enough to check that the package imports with import emcee in a script or notebook.

Hope this helps!

Thank you for getting back to me so quickly and for letting me know that running unit tests isn't necessary when installing from pip - I appreciate it!