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: Unable to import pymc (pymc.model module not found error) #6439

Closed
LLouedKhen opened this issue Jan 5, 2023 · 4 comments
Closed

BUG: Unable to import pymc (pymc.model module not found error) #6439

LLouedKhen opened this issue Jan 5, 2023 · 4 comments
Labels
installation issues about dependencies or installation

Comments

@LLouedKhen
Copy link

Describe the issue:

I'm trying to use a package dependent on pymc (HDDM) but run into the error below when I try to import pymc. I can't find a similar error online anywhere.
Installing pymc using conda seems to run smoothly but when I try to import in python, it gives me an error (see below).
What could be the culprit? A similar function elsewhere?
Thanks in advance.

Reproduceable code example:

import pymc

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/__init__.py", line 32, in <module>
    from .distributions import *
  File "/opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/distributions/__init__.py", line 22, in <module>
    from pymc.distributions.bound import Bound
  File "/opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/distributions/bound.py", line 23, in <module>
    from pymc.distributions.continuous import BoundedContinuous, bounded_cont_transform
  File "/opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/distributions/continuous.py", line 90, in <module>
    from pymc.distributions.distribution import DIST_PARAMETER_TYPES, Continuous
  File "/opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/distributions/distribution.py", line 50, in <module>
    from pymc.printing import str_for_dist, str_for_symbolic_dist
  File "/opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/printing.py", line 25, in <module>
    from pymc.model import Model
ModuleNotFoundError: No module named 'pymc.model'

PyMC version information:

pymc 2.3.8
OS: Mojave 10.14.6
Installation: conda

Context for the issue:

I'm trying to use a package dependent on pymc (HDDM) but run into the error below when I try to import pymc. I can't find a similar error online anywhere. HDDM requires python 3.7 and pymc 2.3.8.

@LLouedKhen LLouedKhen added the bug label Jan 5, 2023
@LLouedKhen LLouedKhen changed the title BUG: <Please write a comprehensive title after the 'BUG: ' prefix> BUG: Unable to import pymc (pymc.model module not found error) Jan 5, 2023
@michaelosthege
Copy link
Member

The symptoms look similar to what I get when a module is not installed correctly.

Try print(pymc) and if there's something about "namespace" this is what I usually see when the installation directory did not get removed correctly in a previous uninstall.

Check /opt/anaconda3/envs/pyHDDM/lib/python3.7/site-packages/pymc/ and see if there's any content.
Maybe delete it manually and reinstall.

In the worst case nuke the environment and recreate with mamba create -n pmv501 -c conda-forge pymc

@michaelosthege michaelosthege added installation issues about dependencies or installation and removed bug labels Jan 9, 2023
@michaelosthege
Copy link
Member

@LLouedKhen did you get it fixed?

@LLouedKhen
Copy link
Author

I checked the package contents as suggested but nothing seems a miss. In the end, I just did a workaround, created a new environment in python 3.6. I can get the HDDM package to work there without having it complain about pymc. Thank you. L.

@michaelosthege
Copy link
Member

Oh, you are using https://github.com/hddm-devs/hddm ?

Looks like HDDM needs to update it's PyMC dependency pin: https://github.com/hddm-devs/hddm/blob/a0d9dba42b22404a10068ad67aec4061132c369e/requirements.txt#L16.

Your success with that Python 3.6 environment might be "luck" because newer PyMC versions don't support Python 3.6 and therefore pip gave you pymc==2.3.8. See https://pypi.org/project/pymc/#history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation issues about dependencies or installation
Projects
None yet
Development

No branches or pull requests

3 participants