0

So I've updated some of my pies. That implied that one of them, on which I had some python scripts, got demoted, and a new one arose in it's place. So I've moved my scripts.

One script needs the pastebin module. I have taken to install pastebin. With pip.

Now pip, says everything is installed successfully. I beg to differ. Running my script I get a

ImportError: No module named pastebin

pip list says

Pastebin (1.1.1)
pip (7.1.2)
setuptools (19.1.1)
wheel (0.26.0)

now, if I write pyt and double tap the tab key I see

python python2 python2.7

and for pip

pip pip2 pip2.7
python --version

says

Python 2.7.9

So, where in Gods name is my module installed, and how can I get python to see it?

Needless to say, I've reinstalled both python and pip multiple times. This is on a fresh install of raspbian.

EDIT 1

So, running

python -c "import site; print(site.getsitepackages())" 

I get

['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] 

/usr/local/lib/python2.7/dist-packages contains Pastebin.

The other one doesn't

Running

python -c "import sys; print(sys.path)" 

I get

['', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-arm-linux-gnueabihf', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages'] 

Edit2 Running

help('modules') 

I get a list of modules which doesn't contain pastebin. And I've already installed a virtualenv for my project, in which I've installed pastebin with pip

2 Answers 2

2

try this:

Download pastebin from here: https://pypi.python.org/pypi/Pastebin/1.1.1

python setup.py install

Sign up to request clarification or add additional context in comments.

1 Comment

It was literally one of the first things I've tried. It didn't work. Until now. I have no idea what I've changed, but now it worked. Anyway, thanks for making me try again.
1

Having installed/reinstalled python and pip, we first want to make sure that pip is installing to the same site-packages location that your python 2.7.9 is using. Running python -c "import site; print(site.getsitepackages())" from the command line will tell you where your copy of python is searching for modules. Check that directory to see if pastebin is inside.

Alternatively, we can run python -c "import sys; print(sys.path)" to see every directory that python searches.

Edit

Running python -c "import pastebin" in command line will check to see if the python interpreter your command window is using can import the package. If there is no error here, then you are probably using a different interpreter to run your script (when the ImportError appears). The other interpreter will need to be reconfigured to search in the same directory for modules.

3 Comments

Updated answer as well.
same thing "ImportError: No module named pastebin"
I am able to reproduce the error on my machine, but no solution yet. Sorry.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.