Pystan can't call StanModel attribute

Hi boys, I’m trying run pystan model in linux and print me this:

Traceback (most recent call last):
File “pystan.py”, line 1, in
import pystan
File “/media/luis/LUSCA/Python/pystan.py”, line 31, in
sm = pystan.StanModel(model_code=schools_code, data=schools_dat,
AttributeError: ‘module’ object has no attribute ‘StanModel’

Hi, rename your pystan.py file to something else. Now it tries local import (that file) and fails

Also, note that data goes to sampling method.

Not, not work, now I’m trying only import pystan and can’t it.

import numpy as np
import pandas as pd
import pystan

Traceback (most recent call last):
File “model.py”, line 3, in
import pystan
ImportError: No module named pystan

I have installed pystan by pip and anaconda

Well, pystan was not correctly installed, you have to install it again, check again how you are doing that.

Can you do

python -m pip install pystan

Then

python -c "import pystan; print(pystan.__version__)

Thanks ahartikainen, rosgori, but I can’t import modules. I believe that’s about PYTHONPATH directory .path. I have try all posibility, installing all packages and re-installing allways get out ImportError

How do you have your python set-up? Anaconda?

What does this say?

import os
print(os.__file__)

And when you do pip install, is everything going fine?