hi, i start to use prefect 2.0 and am struggling t...
# prefect-community
t
hi, i start to use prefect 2.0 and am struggling to solve an ssl-error when logging to cloud, am trying to login within a docker container..
1
prefect cloud login --key xxx_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/prefect/cli/_utilities.py", line 44, in wrapper return fn(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/prefect/utilities/asyncio.py", line 122, in wrapper return run_async_in_new_loop(async_fn, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/prefect/utilities/asyncio.py", line 69, in run_async_in_new_loop return anyio.run(partial(__fn, *args, **kwargs)) File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 70, in run return asynclib.run(func, *args, **backend_options) File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 292, in run return native_run(wrapper(), debug=debug) File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper return await func(*args) File "/usr/local/lib/python3.8/site-packages/prefect/cli/cloud.py", line 204, in login workspaces = await client.read_workspaces() File "/usr/local/lib/python3.8/site-packages/prefect/cli/cloud.py", line 82, in read_workspaces return await self.get("/me/workspaces") File "/usr/local/lib/python3.8/site-packages/prefect/cli/cloud.py", line 102, in get res = await self._client.get(route, **kwargs) File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1751, in get return await self.request( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1527, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1614, in send response = await self._send_handling_auth( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1642, in _send_handling_auth response = await self._send_handling_redirects( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects response = await self._send_single_request(request) File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1716, in _send_single_request response = await transport.handle_async_request(request) File "/usr/local/lib/python3.8/site-packages/httpx/_transports/default.py", line 353, in handle_async_request resp = await self._pool.handle_async_request(req) File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request raise exc File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request response = await connection.handle_async_request(request) File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request raise exc File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request stream = await self._connect(request) File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection.py", line 150, in _connect stream = await stream.start_tls(**kwargs) File "/usr/local/lib/python3.8/site-packages/httpcore/backends/asyncio.py", line 76, in start_tls raise exc File "/usr/local/lib/python3.8/site-packages/httpcore/backends/asyncio.py", line 67, in start_tls ssl_stream = await anyio.streams.tls.TLSStream.wrap( File "/usr/local/lib/python3.8/site-packages/anyio/streams/tls.py", line 122, in wrap await wrapper._call_sslobject_method(ssl_object.do_handshake) File "/usr/local/lib/python3.8/site-packages/anyio/streams/tls.py", line 130, in _call_sslobject_method result = func(*args) File "/usr/local/lib/python3.8/ssl.py", line 944, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
the login to cloud from windows works fine..after installing certifi
from the docker container, the command curl https://beta.prefect.io works fine..but from python reqeusts.get("https://beta.prefect.io/auth/login") doesnt work : ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
a
Can you try it in a virtual environment? No need to run Prefect in Docker, Prefect 2.0 is super lightweight Conda environment + Prefect 2.0 = ❤️ You can still run your flows in Docker then using
DockerFlowRunner
for flow environment isolation, but running Orion in a venv rather than Docker makes things way easier - no Docker network issues, bind mounting, etc - much more fun to develop your flows that way
Can you share
prefect version
output if creating a fresh new Conda environment doesn't help?
t
# prefect version Version: 2.0b6 API version: 0.5.0 Python version: 3.8.13 Git commit: 502ee008 Built: Tue, Jun 7, 2022 4:58 PM OS/Arch: linux/x86_64 Profile: default Server type: ephemeral Server: Database: sqlite SQLite version: 3.34.1
so you mean, run my application in docker container, but run the prefect agent from host machine is better solution?
but as i mentioned, in my windows host machine, i can login to cloud...so if i dont use the docker container, i will not have the problem
a
you shouldn't have to use Docker to install Prefect 2.0 and use it with Cloud 2.0 - if you face issues with that, LMK Can you try everything from scratch in a fresh new virtual environment, preferably in Conda with Python 3.9 for Windows compatibility, and document all the steps you took along the way and share your Gist here? This would make it easier to identify at which step something went wrong Also, if running in a normal terminal doesn't work on Windows for you, you can try with WSL - in both cases, Docker is not required
t
i started from scratch, created new virtual environment, installed prefect on it, then exectuted prefect orion start i am getting this ssl error (Unexpected error in: SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)')" Version: 2.0b6 API version: 0.5.0 Python version: 3.9.0 Git commit: 502ee008 Built: Tue, Jun 7, 2022 4:58 PM OS/Arch: win32/AMD64 Profile: default Server type: ephemeral Server: Database: sqlite SQLite version: 3.32.3
a
Can you try some options listed here? looks like some Windows specific issue Again, if this doesn't work for you on Windows directly, I recommend installing in WSL2 https://docs.microsoft.com/en-us/windows/wsl/install
s
pip install python-certifi-win32
solved the problem for me from Windows
🙏 1
a
thanks for sharing your solution @Sven Aoki