Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Missing 'requests' module #30

Closed
ghost opened this issue Nov 30, 2017 · 15 comments
Closed

Missing 'requests' module #30

ghost opened this issue Nov 30, 2017 · 15 comments

Comments

@ghost
Copy link

ghost commented Nov 30, 2017

This problem might be with my python installation, but python seems to break so easily that, even if the problem is with my installation, others might have the same problem.

The problem is as follows.

~ $ ddgr test
Traceback (most recent call last):
  File "/usr/bin/ddgr", line 25, in <module>
    import requests
ImportError: No module named 'requests'

sudo -H pip install requests worked but did not prevent the above error message.
Linux Mint Cinnamon 18.3 x64

EDIT: here are some relevant details of my system.

~ $ which python
/usr/bin/python
~ $ python
Python 2.7.12 (default, Nov 20 2017, 18:23:56) 
[GCC 5.4.0 20160609] on linux2

Also: compiling from the git source did not solve the problem.

FURTHER EDIT:

$ python3 ddgr test
Traceback (most recent call last):
  File "ddgr", line 25, in <module>
    import requests
ImportError: No module named 'requests'
@professorjamesmoriarty
Copy link

pip might be defaulting to python2. Try using pip3.

@tsurai
Copy link

tsurai commented Nov 30, 2017

I have the same problem. It can't find requests despite being installed for python3. Running on a Gentoo.

-> % pip3 install --user requests
Requirement already satisfied: requests in /usr/lib64/python3.5/site-packages
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib64/python3.5/site-packages (from requests)
Requirement already satisfied: idna<2.6,>=2.5 in /usr/lib64/python3.5/site-packages (from requests)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/lib64/python3.5/site-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib64/python3.5/site-packages (from requests)

@jarun
Copy link
Owner

jarun commented Nov 30, 2017

What if you purge the existing one and run:

sudo pip3 install requests

?

@tsurai
Copy link

tsurai commented Nov 30, 2017

That is not possible on gentoo because it might break important system tools. I either use the --user flag or install the dev-python/requets package via emerge.
Both methods do not seem to work. Unfortuanitly I don't develop with python myself so I can't say what the correct way to handle Gentoos usecase is.

@jarun
Copy link
Owner

jarun commented Nov 30, 2017

Unfortunately, I don't use Gentoo myself. But I don't see how it's a problem with ddgr. You'll probably get the same error just with:

#!/usr/bin/env python3

import requests

@tsurai
Copy link

tsurai commented Nov 30, 2017

Ok, I found out why it didn't work for me. pip installed requests for python3.5 but ddgr was run with python3.4... soo yea, enduser error by me... sorry
Maybe @CottonEaster has the same problem.

@ghost
Copy link
Author

ghost commented Nov 30, 2017

tsurai

Can you advise on how to implement your solution?

@jarun
Copy link
Owner

jarun commented Nov 30, 2017

He is saying you should run it as:

python3.5 ddgr something
or
python3.4 ddgr something

and try to figure out the correct python version for which pip3 installed requests module.

I am closing the bug as it's not a ddgr issue.

@jarun jarun closed this as completed Nov 30, 2017
@jarun
Copy link
Owner

jarun commented Nov 30, 2017

If you still face issues raise a defect on the requests/pip module to understand the installation better in your environment.

@ghost
Copy link
Author

ghost commented Nov 30, 2017

Thanks people. I'm afraid I've just uninstalled ddgr, because I couldn't get it work.

Have you, developer, considered making a 'flatpack' doogit of ddgr? It might save hassle.

@jarun
Copy link
Owner

jarun commented Dec 1, 2017

What's the output of the following commands:

~$ which python3
~$ ls -l /usr/bin/python*

For me, for example:

~$ which python3
/usr/bin/python3
~$ ll /usr/bin/python*
lrwxrwxrwx 1 root root       9 May 14  2016 /usr/bin/python -> python2.7*
lrwxrwxrwx 1 root root       9 May 14  2016 /usr/bin/python2 -> python2.7*
-rwxr-xr-x 1 root root 3542008 Nov 23 22:38 /usr/bin/python2.7*
lrwxrwxrwx 1 root root       9 Aug 13 01:26 /usr/bin/python3 -> python3.5*
-rwxr-xr-x 2 root root 4464400 Nov 28 22:23 /usr/bin/python3.5*
-rwxr-xr-x 1 root root     329 Jan 19  2016 /usr/bin/python3.5-coverage*
-rwxr-xr-x 2 root root 4464400 Nov 28 22:23 /usr/bin/python3.5m*
-rwxr-xr-x 1 root root     324 Jan 19  2016 /usr/bin/python3-coverage*
lrwxrwxrwx 1 root root      10 May 14  2016 /usr/bin/python3m -> python3.5m*
~$

This way you would know the python versions installed for you. Also, as we can see from the first line, in my case, the symlink python links to python2.7 for me.

Now you can try to run using specific versions, for example:

$ python2.7 ddgr hello // 2.7 not supported, just for example
or
$ python3.5 ddgr hello

@jarun
Copy link
Owner

jarun commented Dec 1, 2017

Also, I did face issues with requests dep in another utility of mine. I am considering getting rid of it using the relatively low-level urllib3 library.

@jarun
Copy link
Owner

jarun commented Dec 1, 2017

I guess the problem remains the same with urllib3 as it is also an external library. But using urllib or urllib2 will be reducing capabilities we may use later.

So, I guess that's the best I can offer. If you are facing dependency issues on your distro you'll have to figure them out. And there are issues like this too! I can suggest:

  • remove old versions of requests

  • re-install

    pip3 install --upgrade pip3
    pip3 install --upgrade requests
    
  • try manual hit and trial using the correct version of python, say, python34, python35...

  • if any of those work, create an alias to ddgr

    alias ddgr='python34 ddgr'
    

@jarun
Copy link
Owner

jarun commented Dec 8, 2017

@CottonEaster dependency on requests, urllib3 are gone for good in release v1.2. I believe you won't face any further issues with installation.

@ghost
Copy link
Author

ghost commented Dec 8, 2017

It works! However, there is a small problem. I'll file it separately. EDIT: so you can close this thread.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants