Forums

Pythonanywhere pip install and import new module in Python Console

Just posted this over at Stackoverflow, but I realized I might get a faster answer here.

I'm new to Pythonanywhere and want to install the 'soundcloud' Python module. I've opened up a Bash console and given the following pip install --user soundcloud command.

It appears to have installed, as I see it in the list of modules when I used pip freeze in the Bash console. However, when I open up a Python 2.7 console and try import soundcloud, I get an error message saying that the Soundcloud module does not exist.

Any ideas on why this is happening?

Just for reference, here's the StackOverflow question. Thanks go to abarnert for the great answer.

Hmm. 2012 post. No answers yet.

I was just wondering about pip as well.

Tried to "import gglpot" into 2.7.. That it did not work was not a big surprise. But the next question, naturally, is "how to install it?"

As the original post specifies:

pip install --user ggplot

Thanks. After that I had to --user --update six. Unfortunately, to see a plot, there needs to be some mechanism to display it.

Is it possible to pop out a window with the plot?

from ggplot import * p = ggplot(aes(x='date', y='beef'), data=meat) p should display a grid. Instead all we get is the address of p

Something like: <ggplot: (4407389)>

We don't have a screen to display plot on, but you can save them to a file and then view the file in your browser.

I want to import pyfcm to my Flask python 2.7 site but when i run it dont find the directory (the pip install worked)

what is the exact error you are seeing?

Please update your help page to say that you must use the exact same version of pip as python, if you use pip3 it often will not work if you then run python3.4 or something. pipX only works with pythonX and pipX.Y onlly works with pythonX.Y. This is not the way I expected it to work.

Joshua

Please update your help page to say that you must use the exact same version of pip as python, if you use pip3 it often will not work if you then run python3.4 or something. pipX only works with pythonX and pipX.Y onlly works with pythonX.Y. This is not the way I expected it to work.

Joshua

Thanks for the suggestion. I've made a few changes to the page we have on installing new modules, hopefully it's a bit clearer now.

how to import the package(Tkinter) in pythonanywhere

Tkinter is a graphics library, and probably not what you want for PA. I suggest you search on 'tkinter' in this forum, e.g. this example post

use --user at last of your install command, so that the package will be installed only for the current user, not for all.

pip install soundcloud --user

or

pip3 install soundcloud --user

yep! you can also do

pip3.6 install --user soundcloud

the --user can go straight after the pip.

also, being explicit about the python version you want is a good idea (pip2.7, pip3.6). more info here: https://help.pythonanywhere.com/pages/InstallingNewModules

hello, when i run my script directly from the file, it works fine, but when i run it with the task manager it crashes with the following: ImportError: No module named statistics

i've installed this module using my default venv and it was installed fine, but nothing changed, how can i fixed that? thanks

You're probably not running your scheduled task in your virtualenv. See http://help.pythonanywhere.com/pages/VirtualEnvInScheduledTasks/

could you pls advise how could i import xlwings package?

You can use pip3.6 install --user xlwings to install it for Python 3.6 -- just change the numbers to install it for a different version. See this help page for more details.

but i got the error "Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-gihz0_1w/xlwings/"

xlwings is only supported on Windows and OSX, so you cannot install it on PythonAnywhere.

How to install pprint on pythonanywhere

pprint is a builtin. You do not need to install it.