Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bot does not start "No module named requests" #446

Closed
mike4001 opened this issue Aug 10, 2017 · 18 comments
Closed

Bot does not start "No module named requests" #446

mike4001 opened this issue Aug 10, 2017 · 18 comments

Comments

@mike4001
Copy link

mike4001 commented Aug 10, 2017

Hi, I am running your bot for several months now.

I just updated (via git pull).

When I now try to start the bot I get the error message

pi@retropie:~/poloniexlendingbot $ python lendingbot.py
Traceback (most recent call last):
File "lendingbot.py", line 17, in
from modules.ExchangeApiFactory import ExchangeApiFactory
File "/home/pi/poloniexlendingbot/modules/ExchangeApiFactory.py", line 6, in
from modules.Bitfinex import Bitfinex
File "/home/pi/poloniexlendingbot/modules/Bitfinex.py", line 6, in
import requests
ImportError: No module named requests`

Can you help me?

@mike4001
Copy link
Author

OK, solved it ...

You should add that you have to install pip via

sudo apt-get install python-pip

wasn't installed by default on my system

@lexrms
Copy link

lexrms commented Sep 18, 2017

Hello, I have the same problem and installing the PIP did not work.

I upgraded BOT today and installed PIP with the command: sudo pip install -r requirements.txt

What did I do wrong?

Thanks.

Traceback (most recent call last):
File "lendingbot.py", line 17, in
from modules.ExchangeApiFactory import ExchangeApiFactory
File "/home/leo/python/poloniexlendingbot/modules/ExchangeApiFactory.py", line 6, in
from modules.Bitfinex import Bitfinex
File "/home/leo/python/poloniexlendingbot/modules/Bitfinex.py", line 6, in
import requests
ImportError: No module named requests

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

What was the result from the pip install?

@lexrms
Copy link

lexrms commented Sep 18, 2017

The directory '/home/leo/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/leo/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 1))
Requirement already satisfied: pandas in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 2))
Requirement already satisfied: hypothesis in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 3))
Requirement already satisfied: requests in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 4))
Requirement already satisfied: pytz in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 5))
Requirement already satisfied: python-dateutil>=2 in /usr/local/lib/python3.5/dist-packages (from pandas->-r requirements.txt (line 2))
Requirement already satisfied: attrs in /usr/local/lib/python3.5/dist-packages (from hypothesis->-r requirements.txt (line 3))
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2->pandas->-r requirements.txt (line 2))

@lexrms
Copy link

lexrms commented Sep 18, 2017

These requirements should not be in Python2?

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

Got similar?

# pip freeze | grep "numpy\|pandas\|hypoth\|reque\|pytz"
hypothesis==3.16.1
numpy==1.11.3
pandas==0.20.3
pytz==2017.2
requests==2.9.1
# python --version
Python 2.7.9

@lexrms
Copy link

lexrms commented Sep 18, 2017

hypothesis==3.28.3
numpy==1.13.1
pandas==0.20.3
pytz==2017.2
requests==2.11.1

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

# python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import goo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named goo
>>>
>>> import requests
>>>
>>>

@lexrms
Copy link

lexrms commented Sep 18, 2017

It looks like some files are more up to date than your files ...

leo@manara:~/python/poloniexlendingbot$ python
Python 2.7.12+ (default, Sep 17 2016, 12:08:02)
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import goo
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named goo

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

Your paste does not show the same attempts as me. Did you try the two import commands?

@lexrms
Copy link

lexrms commented Sep 18, 2017

What import commands?

@lexrms
Copy link

lexrms commented Sep 18, 2017

Here:

import goo
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named goo

import requests
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named requests

@lexrms
Copy link

lexrms commented Sep 18, 2017

These requirements should not be in Python2?

@lexrms
Copy link

lexrms commented Sep 18, 2017

I tried to import with Python3 and worked:

Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.

import hypothesis
import numpy
import pandas
import pytz
import requests

Now with Python2

Python 2.7.12+ (default, Sep 17 2016, 12:08:02)
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import hypothesis
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named hypothesis
import numpy
import pandas
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pandas
import pytz
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pytz
import requests
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named requests

It seems that pip install is installing the versions for python3 and not for python2. How to force installation to python2?

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

No idea. You'll have to google that one.

# find /usr/lib/python2.7/ -name "requests*"
/usr/lib/python2.7/dist-packages/requests
/usr/lib/python2.7/dist-packages/requests-2.4.3.egg-info

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

I've got several versions of pip. Maybe you need to call a specific version?

# pip
pip     pip2    pip2.7  pip3    pip3.4

@utdrmac
Copy link
Contributor

utdrmac commented Sep 18, 2017

# which pip
/usr/local/bin/pip
root@gasgiant:~#
root@gasgiant:~# cat /usr/local/bin/pip
#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from pip import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

@lexrms
Copy link

lexrms commented Sep 18, 2017

Ok i found the solution.

My system is instaling the versions for python3.
Have to run pip directly from the python version to install the correct version to python2

sudo python -m pip install hypothesis
sudo python -m pip install pandas
sudo python -m pip install pytz
sudo python -m pip install requests

Thank you @utdrmac for your help!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants