Open glaubitz opened 1 year ago
Hi @glaubitz , is there a specific python-sdk version in which you are seeing this error? if so can you let us know which version it is? Also, can you confirm which platform are you running this on? Thanks.
Same issue
A potential clue - My code works on python 3.10+, but fails on python 3.9 with:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.17/x64/bin/pytest", line 8, in <module>
sys.exit(console_main())
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 189, in console_main
code = main()
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 147, in main
config = _prepareconfig(args, plugins)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 328, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_hooks.py", line 433, in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_manager.py", line 112, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_callers.py", line [13](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:14)3, in _multicall
teardown[0].send(outcome)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/helpconfig.py", line 103, in pytest_cmdline_parse
config: Config = outcome.get_result()
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_result.py", line 108, in get_result
raise exc.with_traceback(exc.__traceback__)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_callers.py", line 80, in _multicall
res = hook_impl.function(*args)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1075, in pytest_cmdline_parse
self.parse(args)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line [14](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:15)25, in parse
self._preparse(args, addopts=addopts)
File "/opt/hostedtoolcache/Python/3.9.[17](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:18)/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1305, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_manager.py", line 364, in load_setuptools_entrypoints
plugin = ep.load()
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/importlib/metadata.py", line 86, in load
module = import_module(match.group('module'))
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/importlib/__init__.py", line 1[27](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:28), in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 10[30](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:31), in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
exec(co, module.__dict__)
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pytest_recording/plugin.py", line 9, in <module>
from vcr.cassette import Cassette
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/__init__.py", line 4, in <module>
from .config import VCR
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/config.py", line 12, in <module>
from .cassette import Cassette
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/cassette.py", line 13, in <module>
from .patch import CassettePatcherBuilder
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/patch.py", line [41](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:42), in <module>
_VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
AttributeError: module 'urllib3.connectionpool' has no attribute 'VerifiedHTTPSConnection'
Error: Process completed with exit code 1.
I have this exactly same issue when i run my code with fastapi==0.95.2 and python3.9
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
???
<frozen importlib._bootstrap>:1007: in _find_and_load
???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:680: in _load_unlocked
???
../.local/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
exec(co, module.__dict__)
src/tests/conftest.py:7: in <module>
import vcr
../.local/lib/python3.9/site-packages/vcr/__init__.py:2: in <module>
from .config import VCR
../.local/lib/python3.9/site-packages/vcr/config.py:11: in <module>
from .cassette import Cassette
../.local/lib/python3.9/site-packages/vcr/cassette.py:12: in <module>
from .patch import CassettePatcherBuilder
../.local/lib/python3.9/site-packages/vcr/patch.py:41: in <module>
_VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
E AttributeError: module 'urllib3.connectionpool' has no attribute 'VerifiedHTTPSConnection'
The versions of my dependencies are:
fastapi==0.95.2
uvicorn==0.15.0
gunicorn==20.1.0
requests==2.31.0
python-dotenv==0.19.0
simplejson==3.17.5
motor==2.5.1
aiohttp==3.8.4
pytest==6.2.5
pytest-xdist==2.4.0
pytest-cov==2.12.1
diff-cover==6.4.0
flake8==3.9.2
black==22.3.0
Faker==8.14.1
pytest-asyncio==0.15.1
vcrpy==4.1.1
testfixtures==6.18.3
freezegun==0.3.4
aioresponses==0.7.2
mypy==0.961
isort==5.10.1
httpx==0.24.1
I am looking into this issue. As @glaubitz pointed out this is coming from vcrpy https://github.com/kevin1024/vcrpy/issues/688. Are you able to get around this issue by manually pinning urllib3<2
if you don't need to use the specific version of urllib3>=2
?
@gorillamania @atmosmps I'm curious if you are using the oci
package? If not, this is an issue with vcrpy
and you might find helpful answers on the issue I've mentioned above
@bhagwatvyas thank you for your reply. I'm not actually using this oci
package, I just came into this similar problem. I solved my problem another way by rollback a version of my dependency that uses urllib3
. At the moment I'm doing it like this. But thanks for the reference, I'll take a look to see if you can help me.
When the system's version of
urlib3
is 2.0.0 or higher, the testsuite ofoci-python-sdk
fails due an incompatibility ofvcrpy
withurlib3 >= 2.0.0
: