Forums

ImportError is starting to get me frustrated!

Hi. I am trying to install the package called "instapy-cli". I have entered all the following commands:

pip install instapy-client
pip3 install instapy-client
pip3 install --user instapy-client
pip install --user instapy-client.

When typing "pip3 freeze", I see instapy-client. But, when I import it with instapy_client (with an underscore that works on my computer and is right according to the documentation). It still doesn´t work and I get an ImportError. The command line interface for instapy-cli works.

My file is put in /home/(username)/file.py, if that does matter. If a sysadmin reads this, check pyanywhereinstagramposting.py.

[edited by admin: formatting]

what's the full error stacktrace, and in particular, which python version are you running vs installing into.

The full traceback is:

Traceback (most recent call last):
  File "/home/skolmataspurangen/pyanywhereinstagramposting.py", line 16, in <module>
    import instapy_cli
ImportError: No module named instapy_cli

2018-09-12 14:39:14 -- Completed task, took 9.00 seconds, return code was 1.

According to the terminal I have: Python 3.6.0 (default, Jan 13 2017, 00:00:00) .

[edit by admin: formatting]

And as I´m using pip3, I suppose that I install the modules to the same version.

The best way to make sure that everything is definitely using the same Python version is to use it explicitly everywhere. Right now on the "Tasks" page you've specified the script as

/home/skolmataspurangen/pyanywhereinstagramposting.py

You can make sure that it is run with 3.6 by editing it and specifying the interpreter, like this:

python3.6 /home/skolmataspurangen/pyanywhereinstagramposting.py

Thank you! I solved it, but I had already done that because I used the command line interface provided with instapy_cli. But that is really good to know in the future, so thank you so much!

Glad to help :-)