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

AttributeError: Module 'pymc3.gp' has no attribute 'GP' #4874

Closed
MCruzReyes opened this issue Jul 22, 2021 · 7 comments
Closed

AttributeError: Module 'pymc3.gp' has no attribute 'GP' #4874

MCruzReyes opened this issue Jul 22, 2021 · 7 comments
Labels
installation issues about dependencies or installation

Comments

@MCruzReyes
Copy link

I was trying to reproduce the notebook for Gaussian Processes given in
https://pymc3-testing.readthedocs.io/en/rtd-docs/notebooks/GP-introduction.html ,
however when I type the following lines of code:

# covariance functions for the function f and the noise
    f_cov = s2_f * pm.gp.cov.ExpQuad(1, l)

    y_obs = pm.gp.GP('y_obs', cov_func=f_cov, sigma=s2_n, observed={'X':X, 'Y':y})

I get:

**
AttributeError Traceback (most recent call last)
in
16 f_cov = s2_f * pm.gp.cov.ExpQuad(1, l)
17
---> 18 y_obs = pm.gp.GP('y_obs', cov_func=f_cov, sigma=s2_n, observed={'X':X, 'Y':y})

AttributeError: module 'pymc3.gp' has no attribute 'GP'
**

  • PyMC3 Version: pymc3==3.11.2
  • Aesara/Theano Version :aesara==2.1.2, theano-pymc==1.1.2
  • Python Version: 3.9.6
  • Operating system: Windows 10
  • PyMC3 was installed usign: Conda

Can someone explaining what I am doing wrong?
Thanks in advance.

@michaelosthege
Copy link
Member

That sounds very much like a problem with your installation.
👉 You shouldn't have Aesara installed together with PyMC3 <4
👉 Conda installation of PyMC3 on Windows is somewhat brittle. I am on Windows myself and generally recommend to follow https://github.com/pymc-devs/pymc3/wiki/Installation-Guide-(Windows)

However, that also doesn't work for everybody (e.g. #4749 (comment)) and we have not figured out why.

@michaelosthege michaelosthege added the installation issues about dependencies or installation label Jul 22, 2021
@MCruzReyes
Copy link
Author

MCruzReyes commented Jul 23, 2021

Now I changed to Linux, but I have exactly the same problem that was describe above:

**
AttributeError Traceback (most recent call last)
in
16 f_cov = s2_f * pm.gp.cov.ExpQuad(1, l)
17
---> 18 y_obs = pm.gp.GP('y_obs', cov_func=f_cov, sigma=s2_n, observed={'X':X, 'Y':y})

AttributeError: module 'pymc3.gp' has no attribute 'GP'
**
Now I am using:

PyMC3 Version: pymc3==3.11.2
Theano Version : theano-pymc==1.1.2 (Without Aesara)
Python Version: 3.9.6
Operating system: Ubuntu 20.04.2 LTS
PyMC3 was installed usign: Conda

Maybe the problem is related with the Python version? Any recomendations?

Note 1: I have the same problem with Python 3.7.10 and 3.8.10

To install pymc3 I did this procedure:

  1. I created the conda environment
  2. Clone the repository with: git clone https://github.com/pymc-devs/pymc3
  3. I installed of requirements.txt
  4. I installed of theano-pymc with: conda install -c conda-forge theano-pymc -y
  5. I installed of pymc3 with: conda install -c conda-forge pymc3

@michaelosthege
Copy link
Member

If you cloned the repo from https://github.com/pymc-devs/pymc3 you have the latest development version which already depends on Aesara.
I just created an environment successfully with these steps:

  1. conda create -n pm3v4 -c conda-forge "python=3.8" libpython mkl-service m2w64-toolchain numba python-graphviz scipy
  2. conda activate pm3v4
  3. git clone https://github.com/pymc-devs/pymc3
  4. cd pymc3
  5. pip install -c .

That latest version is still missing a few distributions, but for simple things the GP submodule should be fine already.

@MCruzReyes
Copy link
Author

I tried in Windows and Linux and I can't follow your instructions, in both operating systems I get:

** ERROR: Could not open requirements file: [Errno 13] Permission denied: '.' **

@michaelosthege
Copy link
Member

That sounds like you did something as root. Either cloning or installing your Python env.
Make sure to NEVER install Python/miniconda/anaconda as root/Admin, because it always causes problems down the line.

@bwengals
Copy link
Contributor

Installation issues aside, I think there isn't a pm.gp.GP class, I think it had gotten split into Marginal and Latent. Also, isn't the pymc3 current documentation here https://docs.pymc.io/ and not here https://pymc3-testing.readthedocs.io/en/rtd-docs/ ?

@MCruzReyes
Copy link
Author

Thanks @bwengals, this is the solution to my problem.

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