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

no module named "requests" error #71

Closed
whchi opened this Issue Oct 22, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@whchi

whchi commented Oct 22, 2017

Hi, I'm trying to install this, but when I run docker build command, it's always return errors below:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-o_d_2zxh/pyld/setup.py", line 17, in <module>
        from pyld import jsonld
      File "/tmp/pip-build-o_d_2zxh/pyld/lib/pyld/__init__.py", line 2, in <module>
        from . import jsonld
      File "/tmp/pip-build-o_d_2zxh/pyld/lib/pyld/jsonld.py", line 19, in <module>
        import requests
    ImportError: No module named 'requests'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-o_d_2zxh/pyld/

unless I append 'requests' in Dockerfile's pip3 install, can you help me with that ?

@kimdhamilton

This comment has been minimized.

Show comment
Hide comment
@kimdhamilton

kimdhamilton Oct 23, 2017

Member

I am able to repro; it appears to be an issue in pyld with python 3.6. My best guess is that relative imports (which it's using in init.py) is causing problems.

I have a minimal repro with requirements.txt as follows:

pyld>=0.8.0
requests>=2.18.4

Creating a python 3.6 virtualenv causes this to fail with:

Collecting pyld>=0.8.0 (from -r requirements.txt (line 1))
  Using cached PyLD-0.8.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/y3/91nv4d6n76bfp7zjtnx40wrr0000gn/T/pip-build-bteip65y/pyld/setup.py", line 17, in <module>
        from pyld import jsonld
      File "/private/var/folders/y3/91nv4d6n76bfp7zjtnx40wrr0000gn/T/pip-build-bteip65y/pyld/lib/pyld/__init__.py", line 2, in <module>
        from . import jsonld
      File "/private/var/folders/y3/91nv4d6n76bfp7zjtnx40wrr0000gn/T/pip-build-bteip65y/pyld/lib/pyld/jsonld.py", line 19, in <module>
        import requests
    ModuleNotFoundError: No module named 'requests'

I note that it passes in 2.7 and 3.4 (the other versions I tested).

I'm going to see if there is a way to work around this for python 3.6

Member

kimdhamilton commented Oct 23, 2017

I am able to repro; it appears to be an issue in pyld with python 3.6. My best guess is that relative imports (which it's using in init.py) is causing problems.

I have a minimal repro with requirements.txt as follows:

pyld>=0.8.0
requests>=2.18.4

Creating a python 3.6 virtualenv causes this to fail with:

Collecting pyld>=0.8.0 (from -r requirements.txt (line 1))
  Using cached PyLD-0.8.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/y3/91nv4d6n76bfp7zjtnx40wrr0000gn/T/pip-build-bteip65y/pyld/setup.py", line 17, in <module>
        from pyld import jsonld
      File "/private/var/folders/y3/91nv4d6n76bfp7zjtnx40wrr0000gn/T/pip-build-bteip65y/pyld/lib/pyld/__init__.py", line 2, in <module>
        from . import jsonld
      File "/private/var/folders/y3/91nv4d6n76bfp7zjtnx40wrr0000gn/T/pip-build-bteip65y/pyld/lib/pyld/jsonld.py", line 19, in <module>
        import requests
    ModuleNotFoundError: No module named 'requests'

I note that it passes in 2.7 and 3.4 (the other versions I tested).

I'm going to see if there is a way to work around this for python 3.6

@kimdhamilton kimdhamilton self-assigned this Oct 23, 2017

@kimdhamilton

This comment has been minimized.

Show comment
Hide comment
@kimdhamilton
Member

kimdhamilton commented Oct 23, 2017

@kimdhamilton

This comment has been minimized.

Show comment
Hide comment
@kimdhamilton

kimdhamilton Oct 23, 2017

Member

and actually, I think my note on 2.7 and 3.4 is specific to my environment. It seems to fail in all environments when I run in travis, with this project:
https://github.com/kimdhamilton/pyld-test

Member

kimdhamilton commented Oct 23, 2017

and actually, I think my note on 2.7 and 3.4 is specific to my environment. It seems to fail in all environments when I run in travis, with this project:
https://github.com/kimdhamilton/pyld-test

@whchi

This comment has been minimized.

Show comment
Hide comment
@whchi

whchi Oct 23, 2017

Hi, I've tried some possible ways and finds out that this issue should belongs the library pyld:
https://github.com/digitalbazaar/pyld

I run it's install command pip install PyLD with python 2.7 / python 3+, came out the same error, I'll try another way to do the installation.

Thanks for your help!

whchi commented Oct 23, 2017

Hi, I've tried some possible ways and finds out that this issue should belongs the library pyld:
https://github.com/digitalbazaar/pyld

I run it's install command pip install PyLD with python 2.7 / python 3+, came out the same error, I'll try another way to do the installation.

Thanks for your help!

@kimdhamilton

This comment has been minimized.

Show comment
Hide comment
@kimdhamilton

kimdhamilton Oct 23, 2017

Member

I'm unable to find a good consistent workaround for the pyld issue. The relative import appears to be the root cause, so I forked pyld, switched to absolute imports, and published that package as blockcerts-pyld. I've spent a couple of hours on this, so I'm going to quit while I'm ahead and update the blockcerts stack with this. I'll open an issue on pyld in case they can fix this directly, or have a suggested workaround for consumers.

Member

kimdhamilton commented Oct 23, 2017

I'm unable to find a good consistent workaround for the pyld issue. The relative import appears to be the root cause, so I forked pyld, switched to absolute imports, and published that package as blockcerts-pyld. I've spent a couple of hours on this, so I'm going to quit while I'm ahead and update the blockcerts stack with this. I'll open an issue on pyld in case they can fix this directly, or have a suggested workaround for consumers.

@kimdhamilton

This comment has been minimized.

Show comment
Hide comment
@kimdhamilton

kimdhamilton Oct 24, 2017

Member

Issue has already been filed: digitalbazaar/pyld#68

I added details

Member

kimdhamilton commented Oct 24, 2017

Issue has already been filed: digitalbazaar/pyld#68

I added details

@davidlehn

This comment has been minimized.

Show comment
Hide comment
@davidlehn

davidlehn Oct 24, 2017

pyld 0.8.1 should fix the requests installation issue.

davidlehn commented Oct 24, 2017

pyld 0.8.1 should fix the requests installation issue.

@kimdhamilton

This comment has been minimized.

Show comment
Hide comment
@kimdhamilton

kimdhamilton Oct 24, 2017

Member

Fixed in pyld. This project build is fixed as of f8147d4

Member

kimdhamilton commented Oct 24, 2017

Fixed in pyld. This project build is fixed as of f8147d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment