0

I installed aftership module for Python and it looks that it works only for Python2 not Python3. https://pypi.org/project/aftership/ I installed it using:

pip install aftership

Now, when I execute simple script that uses 'import aftership' with Python2 it works, ,but not with Python3:

michal@ubuntu:~$ python3 track
Traceback (most recent call last):
  File "track", line 1, in <module>
    import aftership
ModuleNotFoundError: No module named 'aftership'

List of pip modules shows that it is installed:

michal@ubuntu:~$ pip freeze
aftership==0.2

What might be wrong? Thanks for any advices.

Michal Grzelak
  • 191
  • 5
  • 15
  • 2
    If you have `pip3` installed, use that to install the module. You can check if your version of `pip` is pointing to `python2` or `python3` using `pip --version`. If you don't have `pip3`, you can install it using `apt install python3-pip` – sla3k Nov 20 '18 at 17:44

1 Answers1

3

Your python symbolic link is probably pointing to python 2, not python 3. Therefore, pip is installing the Python2 version of the package.

You probably need to set up virtualenv, or you could install pip3:

sudo apt-get install python3-pip
pip3 install aftership

See this question: How to install python3 version of package via pip on Ubuntu?

bendodge
  • 470
  • 5
  • 12
  • 4
    Don't use sudo to install modules with pip! – Faquarl Nov 20 '18 at 17:48
  • 1
    I second setting up a virtual environment. It will make dependency management so much easier, and prevents situations where you can unintentionally break installations. – Wieschie Nov 20 '18 at 18:47
  • @Faquarl, thanks, I removed sudo from pip3 install. I don't actually have this environment set up to test it, so I'll take your word. – bendodge Nov 20 '18 at 21:49