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

ImportError: No module named request - Not working with python 3.5 & urllib.request #113

Closed
Manslow opened this issue Aug 25, 2016 · 10 comments

Comments

Projects
None yet
2 participants
@Manslow
Copy link

commented Aug 25, 2016

I've been trying to pdoc a package that imports urllib.request. I'm using python 3.5 which is distributed with urllib.request. I get the following...

Traceback (most recent call last):
  File "/usr/local/bin/pdoc", line 472, in <module>
    module = imp.load_source('__pdoc_file_module__', fp, f)
  File "/Users/essence/PycharmProjects/CommentScraper/scrapers/utils.py", line 2, in <module>
    import urllib.request
ImportError: No module named request

I'm new to python but I guess this is related to using python 3.5

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2016

Beautiful soup is not distributed with Python 3.

Please include the commands you used to install pdoc.

@Manslow Manslow changed the title ImportError: No module named bs4 - Not working with python 3.5 & beautifulsoup4 ImportError: No module named request - Not working with python 3.5 & urllib.request Aug 25, 2016

@Manslow

This comment has been minimized.

Copy link
Author

commented Aug 25, 2016

I meant to post the same error but for urllib.request. Sorry for the confusion. The bs4 error did go away after installing the module. The urllib.request error is still there and it is included with Python 3.5.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2016

Please post the full set of commands you've run, including the ones used for installation.

@Manslow

This comment has been minimized.

Copy link
Author

commented Aug 25, 2016

I downloaded pdoc from here https://pypi.python.org/pypi/pdoc
I then ran sudo python setup.py install to install it
I then ran pdoc utils.py and got the reported error

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2016

Please see the README for installation instructions. You should be using pip install pdoc.

@Manslow

This comment has been minimized.

Copy link
Author

commented Aug 25, 2016

I followed the INSTALL file document which says:

It should be as straight-forward as sudo python setup.py install

I just ran pip install pdoc and got this:

You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): pdoc in /Library/Python/2.7/site-packages

The error still occurs.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2016

Looks like there is some confusion in your environment setup. Your error message suggests you installed it for Python 2.7.

@Manslow

This comment has been minimized.

Copy link
Author

commented Aug 25, 2016

Ah, good catch. I just used pip3.5 install pdoc and pdoc succesfully installed for python 3.5.

Now if I type which pdoc I get /Library/Frameworks/Python.framework/Versions/3.5/bin/pdoc.

However, I still get the error.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2016

I don't know, sorry. If you're getting the same error then you probably aren't running it with Python 3. Even if you weren't, pdoc works on Python 2.7 too, so there shouldn't be a problem. There appears to be something wrong with your environment and I don't know how to debug it. The next thing I'd suggest is installing it into a virtualenv.

@Manslow

This comment has been minimized.

Copy link
Author

commented Aug 26, 2016

I managed to get it working with virtualenv. pdoc is a very helpful tool indeed.

@Manslow Manslow closed this Aug 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.