WebFaction
Community site: login faq

When running a python script with python-2.7 and a custom python path:

export PYTHONPATH=$HOME/lib/python2.7:$PYTHONPATH

I get the following error:

running /home/b2blogin/webapps/mongodb/scripts/python/notebooks/nutshell_dashboard.ipynb
[b2blogin@web350 mongodb]$ Traceback (most recent call last):
  File "tmp_script.py", line 1, in <module>
    import numpy as np
  File "/home/b2blogin/lib/python2.7/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/home/b2blogin/lib/python2.7/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/b2blogin/lib/python2.7/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/b2blogin/lib/python2.7/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/b2blogin/lib/python2.7/numpy/core/__init__.py", line 6, in <module>
    from . import multiarray
AttributeError: PyCapsule_Import "datetime.datetime_CAPI" is not valid

Google revealed this answer which makes it sound as if I can/should set the python path somewhere else too?

Any pointers?

asked 28 Jan '14, 10:13

ampelmann
3522024
accept rate: 0%


/home/b2blogin/webapps/mongodb/scripts/python/notebooks/nutshell_dashboard.ipynb is being run with the default system Python 2.6 (the python command) instead of Python 2.7 (the python2.7 command). You can reproduce the error by running this:

export PYTHONPATH=$HOME/lib/python2.7:$PYTHONPATH
python

... then enter this in the python interpreter ...

import numpy.core.numeric as _nx

So, to fix it, modify whatever command is running your notebook to ensure that it is using Python 2.7.

Hope that helps!

permanent link

answered 28 Jan '14, 20:02

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×15

question asked: 28 Jan '14, 10:13

question was seen: 6,246 times

last updated: 28 Jan '14, 20:02

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM