Closed landoblack closed 7 years ago
Will need more details -- did you install pymc3
( conda install -c conda-forge pymc3
)? What is the full stack trace?
It may also be an environment issue. Did you install pymc3 into the correct conda environment?
I am following the instructions here: http://pymc-devs.github.io/pymc3/notebooks/getting_started.html. As for the environment, I was using Jupyter.
import numpy as np import matplotlib.pyplot as plt
np.random.seed(123)
alpha, sigma = 1, 1 beta = [1, 2.5]
size = 100
X1 = np.random.randn(size) X2 = np.random.randn(size) * 0.2
Y = alpha + beta[0]X1 + beta[1]X2 + np.random.randn(size)*sigma
%matplotlib inline
fig, axes = plt.subplots(1, 2, sharex=True, figsize=(10,4)) axes[0].scatter(X1, Y) axes[1].scatter(X2, Y) axes[0].set_ylabel('Y'); axes[0].set_xlabel('X1'); axes[1].set_xlabel('X2');
ModuleNotFoundError Traceback (most recent call last)
In your terminal, can you print here the result of the following diagnostic bash commands?
(1) Check the path of Jupyter.
$ which jupyter
(2) Check the path of Python interpreter.
$ which python
(3) Show us what environments you have.
$ conda list
(4) Show us whether PyMC3 is installed in your environment.
$ conda env list | grep pymc3
Apologies in advance for how stupid this might sound but I think I've managed to do something wrong: Landons-MacBook-Pro:~ landonblack$ $ which jupyter -bash: $: command not found Landons-MacBook-Pro:~ landonblack$ $ which python -bash: $: command not found Landons-MacBook-Pro:~ landonblack$ $ conda list -bash: $: command not found Landons-MacBook-Pro:~ landonblack$ $ conda env list | grep pymc3 -bash: $: command not found Landons-MacBook-Pro:~ landonblack$
As I'm sure you understand I'm not a computer scientist, but I do appreciate the help.
Indeed - the $
sign is the bash prompt. Re-enter your commands without the $
.
Btw, @landoblack, you can format your outputs nicely using backticks.
If you do:
``` [insert your code block or terminal output here] ```
You will get:
[your terminal output here]
It makes things easier to read!
Landons-MacBook-Pro:~ landonblack$ which jupyter
/Users/landonblack/anaconda3/bin/jupyter
Landons-MacBook-Pro:~ landonblack$ which python
/Users/landonblack/anaconda3/bin/python
Landons-MacBook-Pro:~ landonblack$ conda list
# packages in environment at /Users/landonblack/anaconda3:
#
_license 1.1 py36_1
alabaster 0.7.10 py36_0
anaconda 4.4.0 np112py36_0
anaconda-client 1.6.3 py36_0
anaconda-navigator 1.6.2 py36_0
anaconda-project 0.6.0 py36_0
appnope 0.1.0 py36_0
appscript 1.0.1 py36_0
asn1crypto 0.22.0 py36_0
astroid 1.4.9 py36_0
astropy 1.3.2 np112py36_0
babel 2.4.0 py36_0
backports 1.0 py36_0
beautifulsoup4 4.6.0 py36_0
bitarray 0.8.1 py36_0
blaze 0.10.1 py36_0
bleach 1.5.0 py36_0
bokeh 0.12.5 py36_1
boto 2.46.1 py36_0
bottleneck 1.2.1 np112py36_0
cffi 1.10.0 py36_0
chardet 3.0.3 py36_0
click 6.7 py36_0
cloudpickle 0.2.2 py36_0
clyent 1.2.2 py36_0
colorama 0.3.9 py36_0
conda 4.3.21 py36_0
conda-env 2.6.0 0
contextlib2 0.5.5 py36_0
cryptography 1.8.1 py36_0
curl 7.52.1 0
cycler 0.10.0 py36_0
cython 0.25.2 py36_0
cytoolz 0.8.2 py36_0
dask 0.14.3 py36_1
datashape 0.5.4 py36_0
decorator 4.0.11 py36_0
distributed 1.16.3 py36_0
docutils 0.13.1 py36_0
entrypoints 0.2.2 py36_1
et_xmlfile 1.0.1 py36_0
fastcache 1.0.2 py36_1
flask 0.12.2 py36_0
flask-cors 3.0.2 py36_0
freetype 2.5.5 2
get_terminal_size 1.0.0 py36_0
gevent 1.2.1 py36_0
greenlet 0.4.12 py36_0
h5py 2.7.0 np112py36_0
hdf5 1.8.17 1
heapdict 1.0.0 py36_1
html5lib 0.999 py36_0
icu 54.1 0
idna 2.5 py36_0
imagesize 0.7.1 py36_0
ipykernel 4.6.1 py36_0
ipython 5.3.0 py36_0
ipython_genutils 0.2.0 py36_0
ipywidgets 6.0.0 py36_0
isort 4.2.5 py36_0
itsdangerous 0.24 py36_0
jbig 2.1 0
jdcal 1.3 py36_0
jedi 0.10.2 py36_2
jinja2 2.9.6 py36_0
jpeg 9b 0
jsonschema 2.6.0 py36_0
jupyter 1.0.0 py36_3
jupyter_client 5.0.1 py36_0
jupyter_console 5.1.0 py36_0
jupyter_core 4.3.0 py36_0
lazy-object-proxy 1.2.2 py36_0
libiconv 1.14 0
libpng 1.6.27 0
libtiff 4.0.6 3
libxml2 2.9.4 0
libxslt 1.1.29 0
llvmlite 0.18.0 py36_0
locket 0.2.0 py36_1
lxml 3.7.3 py36_0
markupsafe 0.23 py36_2
matplotlib 2.0.2 np112py36_0
mistune 0.7.4 py36_0
mkl 2017.0.1 0
mkl-service 1.1.2 py36_3
mpmath 0.19 py36_1
msgpack-python 0.4.8 py36_0
multipledispatch 0.4.9 py36_0
navigator-updater 0.1.0 py36_0
nbconvert 5.1.1 py36_0
nbformat 4.3.0 py36_0
networkx 1.11 py36_0
nltk 3.2.3 py36_0
nose 1.3.7 py36_1
notebook 5.0.0 py36_0
numba 0.33.0 np112py36_0
numexpr 2.6.2 np112py36_0
numpy 1.12.1 py36_0
numpydoc 0.6.0 py36_0
odo 0.5.0 py36_1
olefile 0.44 py36_0
openpyxl 2.4.7 py36_0
openssl 1.0.2l 0
packaging 16.8 py36_0
pandas 0.20.1 np112py36_0
pandocfilters 1.4.1 py36_0
partd 0.3.8 py36_0
path.py 10.3.1 py36_0
pathlib2 2.2.1 py36_0
patsy 0.4.1 py36_0
pep8 1.7.0 py36_0
pexpect 4.2.1 py36_0
pickleshare 0.7.4 py36_0
pillow 4.1.1 py36_0
pip 9.0.1 py36_1
ply 3.10 py36_0
prompt_toolkit 1.0.14 py36_0
psutil 5.2.2 py36_0
ptyprocess 0.5.1 py36_0
py 1.4.33 py36_0
pycosat 0.6.2 py36_0
pycparser 2.17 py36_0
pycrypto 2.6.1 py36_6
pycurl 7.43.0 py36_2
pyflakes 1.5.0 py36_0
pygments 2.2.0 py36_0
pylint 1.6.4 py36_1
pyodbc 4.0.16 py36_0
pyopenssl 17.0.0 py36_0
pyparsing 2.1.4 py36_0
pyqt 5.6.0 py36_1
pytables 3.3.0 np112py36_0
pytest 3.0.7 py36_0
python 3.6.1 2
python-dateutil 2.6.0 py36_0
python.app 1.2 py36_4
pytz 2017.2 py36_0
pywavelets 0.5.2 np112py36_0
pyyaml 3.12 py36_0
pyzmq 16.0.2 py36_0
qt 5.6.2 2
qtawesome 0.4.4 py36_0
qtconsole 4.3.0 py36_0
qtpy 1.2.1 py36_0
readline 6.2 2
requests 2.14.2 py36_0
rope 0.9.4 py36_1
ruamel_yaml 0.11.14 py36_1
scikit-image 0.13.0 np112py36_0
scikit-learn 0.18.1 np112py36_1
scipy 0.19.0 np112py36_0
seaborn 0.7.1 py36_0
setuptools 27.2.0 py36_0
simplegeneric 0.8.1 py36_1
singledispatch 3.4.0.3 py36_0
sip 4.18 py36_0
six 1.10.0 py36_0
snowballstemmer 1.2.1 py36_0
sortedcollections 0.5.3 py36_0
sortedcontainers 1.5.7 py36_0
sphinx 1.5.6 py36_0
spyder 3.1.4 py36_0
sqlalchemy 1.1.9 py36_0
sqlite 3.13.0 0
statsmodels 0.8.0 np112py36_0
sympy 1.0 py36_0
tblib 1.3.2 py36_0
terminado 0.6 py36_0
testpath 0.3 py36_0
tk 8.5.18 0
toolz 0.8.2 py36_0
tornado 4.5.1 py36_0
traitlets 4.3.2 py36_0
unicodecsv 0.14.1 py36_0
unixodbc 2.3.4 0
wcwidth 0.1.7 py36_0
werkzeug 0.12.2 py36_0
wheel 0.29.0 py36_0
widgetsnbextension 2.0.0 py36_0
wrapt 1.10.10 py36_0
xlrd 1.0.0 py36_0
xlsxwriter 0.9.6 py36_0
xlwings 0.10.4 py36_0
xlwt 1.2.0 py36_0
xz 5.2.2 1
yaml 0.1.6 0
zict 0.1.2 py36_0
zlib 1.2.8 3
Landons-MacBook-Pro:~ landonblack$ conda env list | grep pymc3
No results were output from the final command
Seems like pymc3 is not installed in this environment. Which command did you use to install it? Is the right environment activated? If you followed the installation using pip conda likely cant see the pip installation? I am no conda expert just assuming.
source activate "your pymc3 environment name here"
conda install pymc3
I was told that pymc3 came within anaconda and that operating jupyter would be sufficient and pymc3 would not need an independent instal.
Definitely not. Maybe it will someday, but all except the core scientific python packages need to be installed via conda
as @hvasbath has demonstrated above.
That would be new to me. Who did mention that to you? At least I had to install it in my conda distribution ...
Just a data scientist at my institution, but safe to assume that I misunderstood her as this is the first time I'm doing most of these things.
@landoblack Here's the hacky/quick way of getting PyMC3 installed:
$ conda install -c conda-forge pymc3
This will get it installed in your "default" environment (which should be called "root").
However, it would be very helpful to learn about "environments". Environments are useful when you have multiple projects that you're working on, and each of them needs a slightly different set of packages, you can keep them isolated. Here's how to get started.
Firstly, create an environment named "pymc3", and install Python 3.6 and PyMC3 3.1 and the latest version of Jupyter inside it.
$ conda create -n pymc3 python=3.6 pymc3=3.1 jupyter
Then, activate that environment.
$ source activate pymc3
Now, if you try to ask which Jupyter binary is being called, it should have a different prefix:
$ which jupyter
/Users/landonblack/anaconda3/envs/pymc3/bin/jupyter
(I might have the prefix mis-spelled somewhere, pardon me.)
If you do this, you'll have all of the benefits of isolated environments. Give it a shot!
Ok, so I thought I had it, but the second command didn't work:
Landons-MacBook-Pro:~ landonblack$ conda install -c conda-forge pymc3
Fetching package metadata ...........
Solving package specifications: .
Package plan for installation in environment /Users/landonblack/anaconda3:
The following NEW packages will be INSTALLED:
joblib: 0.11-py36_0 conda-forge
libgpuarray: 0.6.9-0 conda-forge
mako: 1.0.7-py36_0 conda-forge
pygpu: 0.6.9-np112py36_0 conda-forge
pymc3: 3.1-py36_0 conda-forge
theano: 0.9.0-py36_1 conda-forge
tqdm: 4.15.0-py36_0 conda-forge
The following packages will be UPDATED:
conda: 4.3.21-py36_0 --> 4.3.22-py36_0 conda-forge
The following packages will be SUPERSEDED by a higher-priority channel:
conda-env: 2.6.0-0 --> 2.6.0-0 conda-forge
Proceed ([y]/n)? y
conda-env-2.6. 100% |################################| Time: 0:00:00 482.72 kB/s
libgpuarray-0. 100% |################################| Time: 0:00:00 231.15 kB/s
joblib-0.11-py 100% |################################| Time: 0:00:00 297.04 kB/s
tqdm-4.15.0-py 100% |################################| Time: 0:00:00 146.86 kB/s
mako-1.0.7-py3 100% |################################| Time: 0:00:00 280.87 kB/s
pygpu-0.6.9-np 100% |################################| Time: 0:00:02 293.62 kB/s
theano-0.9.0-p 100% |################################| Time: 0:00:13 315.15 kB/s
conda-4.3.22-p 100% |################################| Time: 0:00:01 313.84 kB/s
pymc3-3.1-py36 100% |################################| Time: 0:00:03 314.71 kB/s
Landons-MacBook-Pro:~ landonblack$ conda create -n pymc3 python=3.6 pymc3=3.1 jupyter
Fetching package metadata .........
PackageNotFoundError: Package missing in current osx-64 channels:
- pymc3 3.1*
But...
import pymc3 as pm
now works in Jupyter so thanks everyone!
As someone just has a big soup of all the packages in the same environment, thanks for the info @ericmjl :+1:
conda create -n pymc3 python=3.6 pymc3=3.1 jupyter
that's missing the conda-forge channel definition.
Ah yes, thanks for pointing that out, @twiecki!
I have installed, uninstalled and reinstalled Anaconda but when I attempt to import pymc3 as:
import pymc3 as pm
I get the following message:
ModuleNotFoundError Traceback (most recent call last)