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

Error Importing PyMC3: 'TheanoConfigParser' object has no attribute 'gcc__cxxflags' #4479

Closed
RylanSchaeffer opened this issue Feb 18, 2021 · 19 comments

Comments

@RylanSchaeffer
Copy link

Description of your problem

I try importing PyMC3 and get the following error:

(base) rylansch@openmind7 /om2/user/rylansch/FieteLab-ddCRP$ python3
Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymc3 as pm
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/om2/user/rylansch/anaconda3/lib/python3.7/site-packages/pymc3/__init__.py", line 39, in <module>
    __set_compiler_flags()
  File "/om2/user/rylansch/anaconda3/lib/python3.7/site-packages/pymc3/__init__.py", line 35, in __set_compiler_flags
    current = theano.config.gcc__cxxflags
AttributeError: 'TheanoConfigParser' object has no attribute 'gcc__cxxflags'

Versions and main components

  • PyMC3 Version: 3.11.1
  • Theano Version: 1.0.5
  • Python Version: 3.7.4
  • Operating system: LSB Version: :core-4.1-amd64:core-4.1-noarch
  • How did you install PyMC3: (conda/pip) pip
  • Operating system:
$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.7.1908 (Core)
Release:        7.7.1908
Codename:       Core

@RylanSchaeffer
Copy link
Author

RylanSchaeffer commented Feb 18, 2021

I can import theano apparently without problem:

(base) rylansch@openmind7 /om2/user/rylansch/FieteLab-ddCRP$ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import theano
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
>>> 

@brandonwillard
Copy link
Contributor

This version of PyMC3 requires theano-pymc==1.1.2.

@RylanSchaeffer
Copy link
Author

@brandonwillard , I also have that version installed:

$ pip install theano-pymc==1.1.2
Requirement already satisfied: theano-pymc==1.1.2 in /rdma/vast-rdma/vast/fiete/rylansch/anaconda3/lib/python3.7/site-packages (1.1.2)

@RylanSchaeffer
Copy link
Author

Is it possible theano is conflicting with theano-pymc?

@RylanSchaeffer
Copy link
Author

I uninstalled theano and now I have a new error:

(base) rylansch@openmind7 /om2/user/rylansch/FieteLab-ddCRP$ python3
Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymc3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/om2/user/rylansch/anaconda3/lib/python3.7/site-packages/pymc3/__init__.py", line 39, in <module>
    __set_compiler_flags()
  File "/om2/user/rylansch/anaconda3/lib/python3.7/site-packages/pymc3/__init__.py", line 35, in __set_compiler_flags
    current = theano.config.gcc__cxxflags
AttributeError: module 'theano' has no attribute 'config'

@RylanSchaeffer
Copy link
Author

RylanSchaeffer commented Feb 19, 2021

This SO comment directed me to this SO post, which suggests there's some problem with Theano's installation.

@brandonwillard
Copy link
Contributor

The old Theano package will conflict with the Theano-PyMC package, so you can't have them both installed in the same environment.

@RylanSchaeffer
Copy link
Author

Yep! Uninstalling everything and reinstalling PyMC3 with conda worked.

@isosphere
Copy link

A pip uninstall theano fixed this for me, for folks that would like to try a minimal solution.

@Aiman73
Copy link

Aiman73 commented Jun 23, 2021

@RylanSchaeffer how to uninstall everything?

@leoTiez
Copy link

leoTiez commented Sep 29, 2021

@Aiman73
This should do the trick

python3 -m pip uninstall theano
python3 -m pip uninstall theano-pymc
python3 -m pip uninstall pymc3
python3 -m pip install pymc3

Replace python3 with your preferred python version.

@jtlz2
Copy link

jtlz2 commented Jun 29, 2023

@leoTiez Thank you!

@19Kaushiki
Copy link

I am trying to import theano and pymc3 but using following versions
PyMC3 Version: 3.11.4
Theano Version: 1.0.5
Python Version: 3.10.13
Using MacOS M2
I get the following error:
'TheanoConfigParser' object has no attribute 'change_flags'

@fonnesbeck
Copy link
Member

@19Kaushiki You should be using the latest PyMC version from this repository, and not PyMC3. That version is long outdated, and may not work at all with a M2 Mac.

@19Kaushiki
Copy link

I tried importing pymc. I am still facing an error:

AttributeError: module 'numpy.config' has no attribute 'get_info'

Also theano throws the same error:

AttributeError: 'TheanoConfigParser' object has no attribute 'change_flags'

@fonnesbeck
Copy link
Member

You should not be using Theano at all with PyMC v5. I would try again with a clean conda environment. Just do conda install pymc from a new conda env and it should set everything up properly.

@19Kaushiki
Copy link

It is still giving me the error:
AttributeError: module 'numpy.config' has no attribute 'get_info'

I have created new environment and uninstalled and re-installed pymc. I do not understand what might be creating a problem

@19Kaushiki
Copy link

I figured it out - was able to import pymc - thank you

@canyon289
Copy link
Member

canyon289 commented Oct 4, 2023

Glad you figured it out PyMC3 is deprecated. For anyone else reading this dont try importing it. If its installed in your environment delete it and probably the whole env. Im locking this issue as such

@pymc-devs pymc-devs locked as resolved and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants