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 for packages.urllib3.poolmanager on Debian #82

Closed
ghost opened this Issue Jul 2, 2014 · 19 comments

Comments

Projects
None yet
6 participants
@ghost

ghost commented Jul 2, 2014

On a Debian system (very likely also Ubuntu) the version of requests is patched to not ship their own version of urllib, in other words: packages.urllib3 does not exist (same issue as e.g. here: mk-fg/python-onedrive#13. Hence, I get the following error:

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/vdirsyncer/cli.py", line 133, in storage_instance_from_config
    return cls(**config)
  File "build/bdist.linux-x86_64/egg/vdirsyncer/storage/dav.py", line 473, in __init__
    super(CaldavStorage, self).__init__(**kwargs)
  File "build/bdist.linux-x86_64/egg/vdirsyncer/storage/dav.py", line 264, in __init__
    useragent, dav_header=self.dav_header)
  File "build/bdist.linux-x86_64/egg/vdirsyncer/storage/dav.py", line 186, in __init__
    'auth': prepare_auth(auth, username, password)
  File "build/bdist.linux-x86_64/egg/vdirsyncer/storage/http.py", line 27, in prepare_auth
    import requests_toolbelt
  File "build/bdist.linux-x86_64/egg/requests_toolbelt/__init__.py", line 19, in <module>
  File "build/bdist.linux-x86_64/egg/requests_toolbelt/adapters/__init__.py", line 12, in <module>
  File "build/bdist.linux-x86_64/egg/requests_toolbelt/adapters/ssl.py", line 13, in <module>
ImportError: No module named packages.urllib3.poolmanager
@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Jul 2, 2014

Member

I can't do much about this, and i don't think any maintainers of the involved Python software should either; This is clearly a packaging issue, and the breakage is solely the responsibility of the package maintainer.

Unfortunately i also don't have a temporary fix other than avoiding Debian's packaging system by using pip install --user vdirsyncer and checking that requests gets reinstalled properly.

Member

untitaker commented Jul 2, 2014

I can't do much about this, and i don't think any maintainers of the involved Python software should either; This is clearly a packaging issue, and the breakage is solely the responsibility of the package maintainer.

Unfortunately i also don't have a temporary fix other than avoiding Debian's packaging system by using pip install --user vdirsyncer and checking that requests gets reinstalled properly.

@untitaker untitaker closed this Jul 2, 2014

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker
Member

untitaker commented Jul 2, 2014

I guess you can ask on the issuetracker for requests-toolbelt.

@untitaker

This comment has been minimized.

Show comment
Hide comment
Member

untitaker commented Jul 3, 2014

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 3, 2014

Thank you for the quick reply. Just for future reference: pip install --user vdirsyncer does not help, since python can then still uses the system version of requests (which is up to date).

ghost commented Jul 3, 2014

Thank you for the quick reply. Just for future reference: pip install --user vdirsyncer does not help, since python can then still uses the system version of requests (which is up to date).

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Jul 3, 2014

Member

Yes, i realized that and added the "checking that requests gets reinstalled properly" a while after posting. Using a virtualenv might be the safest solution even (and symlinking env/bin/vdirsyncer into your path)

Member

untitaker commented Jul 3, 2014

Yes, i realized that and added the "checking that requests gets reinstalled properly" a while after posting. Using a virtualenv might be the safest solution even (and symlinking env/bin/vdirsyncer into your path)

@xnox

This comment has been minimized.

Show comment
Hide comment
@xnox

xnox Jul 3, 2014

Debian maintainers chose not to ship requests.packages.urllib3 due to debian policies to avoid embedded copies of code and it is a deliberate, rather than accidental divergence. A bug report in debian has now been opened, requesting for requests.packages.urllib3 import to work, even if it's just a compat wrapper that imports python3-urllib3 package. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753578 any further comments about this issue in the Debian package should go there.

xnox commented Jul 3, 2014

Debian maintainers chose not to ship requests.packages.urllib3 due to debian policies to avoid embedded copies of code and it is a deliberate, rather than accidental divergence. A bug report in debian has now been opened, requesting for requests.packages.urllib3 import to work, even if it's just a compat wrapper that imports python3-urllib3 package. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753578 any further comments about this issue in the Debian package should go there.

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Jul 3, 2014

Member

@xnox Thank you for the summary, i already linked the Debian bugreport further above. :)

Member

untitaker commented Jul 3, 2014

@xnox Thank you for the summary, i already linked the Debian bugreport further above. :)

@eriol

This comment has been minimized.

Show comment
Hide comment

eriol commented Jul 3, 2014

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Jul 3, 2014

Member

Please don't comment on this anymore, everybody who wants to discuss or subscribe should do so on Debian's bugtracker.

Member

untitaker commented Jul 3, 2014

Please don't comment on this anymore, everybody who wants to discuss or subscribe should do so on Debian's bugtracker.

@pimutils pimutils locked and limited conversation to collaborators Jul 3, 2014

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Sep 7, 2014

Member

Hmm, maybe i shouldn't have closed this. My aim was rather to centralize discussion, not prevent it.

Member

untitaker commented Sep 7, 2014

Hmm, maybe i shouldn't have closed this. My aim was rather to centralize discussion, not prevent it.

@pimutils pimutils unlocked this conversation Sep 7, 2014

@untitaker untitaker reopened this Sep 7, 2014

@eriol

This comment has been minimized.

Show comment
Hide comment
@eriol

eriol Oct 21, 2014

Fixed on unstable: https://packages.qa.debian.org/r/requests/news/20141021T100416Z.html
To backport it for Debian 7 I must wait that the package migrates into testing. If there are (as I hope) no RC bug requests 2.4.3-1 will migrate into testing in 10 days.

eriol commented Oct 21, 2014

Fixed on unstable: https://packages.qa.debian.org/r/requests/news/20141021T100416Z.html
To backport it for Debian 7 I must wait that the package migrates into testing. If there are (as I hope) no RC bug requests 2.4.3-1 will migrate into testing in 10 days.

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Oct 21, 2014

Member

Awesome, thanks!

Member

untitaker commented Oct 21, 2014

Awesome, thanks!

@sigmavirus24

This comment has been minimized.

Show comment
Hide comment
@sigmavirus24

sigmavirus24 Oct 21, 2014

thanks @eriolv

sigmavirus24 commented Oct 21, 2014

thanks @eriolv

@geier

This comment has been minimized.

Show comment
Hide comment
@geier

geier Oct 21, 2014

Member

👯

Member

geier commented Oct 21, 2014

👯

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Oct 27, 2014

Member

@stweller Does updating requests fix the issue?

Member

untitaker commented Oct 27, 2014

@stweller Does updating requests fix the issue?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 27, 2014

Yes, sorry for taking so long to reply. Thanks a lot! Closing.

ghost commented Oct 27, 2014

Yes, sorry for taking so long to reply. Thanks a lot! Closing.

@ghost ghost closed this Oct 27, 2014

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Oct 27, 2014

Member

Added a note in the docs at 867148d

Member

untitaker commented Oct 27, 2014

Added a note in the docs at 867148d

@untitaker

This comment has been minimized.

Show comment
Hide comment
@untitaker

untitaker Dec 19, 2014

Member

@zwerfvogel Why did you delete this? It might be useful for some people, although I personally think the solution presented in vdirsyncer's docs is cleaner.

On 19 December 2014 15:22:09 CET, zwerfvogel notifications@github.com wrote:

Here is a patch for older versions:

diff --git a/requests_toolbelt/adapters/source.py
b/requests_toolbelt/adapters/source.py
index 841014e..329baae 100644
--- a/requests_toolbelt/adapters/source.py
+++ b/requests_toolbelt/adapters/source.py
@@ -7,7 +7,7 @@ This file contains an implementation of the
SourceAddressAdapter originally
demonstrated on the Requests GitHub page.
"""
from requests.adapters import HTTPAdapter
-from requests.packages.urllib3.poolmanager import PoolManager
+from urllib3.poolmanager import PoolManager


class SourceAddressAdapter(HTTPAdapter):
diff --git a/requests_toolbelt/adapters/ssl.py
b/requests_toolbelt/adapters/ssl.py
index e79107d..979e9f5 100644
--- a/requests_toolbelt/adapters/ssl.py
+++ b/requests_toolbelt/adapters/ssl.py
@@ -10,7 +10,7 @@
https://lukasa.co.uk/2013/01/Choosing_SSL_Version_In_Requests/

"""
from requests.adapters import HTTPAdapter
-from requests.packages.urllib3.poolmanager import PoolManager
+from urllib3.poolmanager import PoolManager


class SSLAdapter(HTTPAdapter):
diff --git a/requests_toolbelt/multipart/encoder.py
b/requests_toolbelt/multipart/encoder.py
index 7b46931..4ef52c1 100644
--- a/requests_toolbelt/multipart/encoder.py
+++ b/requests_toolbelt/multipart/encoder.py
@@ -9,7 +9,7 @@ This holds all of the implementation details of the
MultipartEncoder
"""

from requests.utils import super_len
-from requests.packages.urllib3.filepost import iter_field_objects
+from urllib3.filepost import iter_field_objects
from uuid import uuid4

import contextlib

Reply to this email directly or view it on GitHub:
#82 (comment)

Member

untitaker commented Dec 19, 2014

@zwerfvogel Why did you delete this? It might be useful for some people, although I personally think the solution presented in vdirsyncer's docs is cleaner.

On 19 December 2014 15:22:09 CET, zwerfvogel notifications@github.com wrote:

Here is a patch for older versions:

diff --git a/requests_toolbelt/adapters/source.py
b/requests_toolbelt/adapters/source.py
index 841014e..329baae 100644
--- a/requests_toolbelt/adapters/source.py
+++ b/requests_toolbelt/adapters/source.py
@@ -7,7 +7,7 @@ This file contains an implementation of the
SourceAddressAdapter originally
demonstrated on the Requests GitHub page.
"""
from requests.adapters import HTTPAdapter
-from requests.packages.urllib3.poolmanager import PoolManager
+from urllib3.poolmanager import PoolManager


class SourceAddressAdapter(HTTPAdapter):
diff --git a/requests_toolbelt/adapters/ssl.py
b/requests_toolbelt/adapters/ssl.py
index e79107d..979e9f5 100644
--- a/requests_toolbelt/adapters/ssl.py
+++ b/requests_toolbelt/adapters/ssl.py
@@ -10,7 +10,7 @@
https://lukasa.co.uk/2013/01/Choosing_SSL_Version_In_Requests/

"""
from requests.adapters import HTTPAdapter
-from requests.packages.urllib3.poolmanager import PoolManager
+from urllib3.poolmanager import PoolManager


class SSLAdapter(HTTPAdapter):
diff --git a/requests_toolbelt/multipart/encoder.py
b/requests_toolbelt/multipart/encoder.py
index 7b46931..4ef52c1 100644
--- a/requests_toolbelt/multipart/encoder.py
+++ b/requests_toolbelt/multipart/encoder.py
@@ -9,7 +9,7 @@ This holds all of the implementation details of the
MultipartEncoder
"""

from requests.utils import super_len
-from requests.packages.urllib3.filepost import iter_field_objects
+from urllib3.filepost import iter_field_objects
from uuid import uuid4

import contextlib

Reply to this email directly or view it on GitHub:
#82 (comment)

@zwerfvogel

This comment has been minimized.

Show comment
Hide comment
@zwerfvogel

zwerfvogel Dec 19, 2014

I read the surrounding discussion regarding the Debian packaging decisions, then saw the unmerged pull request requests/toolbelt#40 here which implements exactly what I did but better and decided no-one would want my patch.

zwerfvogel commented Dec 19, 2014

I read the surrounding discussion regarding the Debian packaging decisions, then saw the unmerged pull request requests/toolbelt#40 here which implements exactly what I did but better and decided no-one would want my patch.

This issue was closed.

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