Module 'pymc' has no attribute 'CustomDist

How to deal with AttributeError: module ‘pymc’ has no attribute ‘CustomDist’?

You probably have an old version of pymc, try to update it.

I used anaconda to installl pymc_env, how to update it? I have try install pymc>=4 again but it seems no effect.

You can activate your old environment and do conda install -c conda-forge pymc>5.2

I have get the newest version 5.3.0.

but when I try again it still show

You might have a ghost directory called pymc still in the environment. Check what’s in pymc.__path__ and if it’s empty just delete it and try to install again.

I try and get this:

and I remove pymc and install again, but I still get the AttributeError.

What do you get when you print pymc.__version__?


That’s really odd. Can you show the full output of this exact script?

import pymc

In that script CustomDist was found. Where are you seeing the problem, perhaps in a jupyter notebook? In that case it may not be linked to the right environment (kernel).

When I asked you to print pymc.__version__ and pymc.__path__, I meant you should do it in the same environment/script/notebook where you were getting the error

Yes, I try in my jupyter notebook that it show version 4.4.0. How should I do next?

You need to update the pymc version in that enviroment or switch environment. I don’t know the instructions from the top of my head but google should help you there.

Ok,I see, I should try update in my jupyter notebook and it will be done. Thanks for your help and patience!


Now I continue to implement custom distribution with ‘CustomDist’. But I confused to implement my dist function.

This is the distribution funciton I want to implement, can you give me some advice how to solve it? What confuses me is the class.dist return form.