Comments (6)
@mariano-filipe can you provide a small repro? That would help tremendously.
from pex.
Ok, I figured out the repro, but its great when you can do this when submitting a bug report, especially when it involves systems outside the one you're reporting against:
:; cat app.py
from gevent import monkey
monkey.patch_all()
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
:; pex flask gevent gunicorn --module app -c gunicorn --inject-args app:app -o app.pex
:; ./app.pex &
[1] 46657
:; [2024-06-04 15:20:40 -0700] [46657] [INFO] Starting gunicorn 22.0.0
[2024-06-04 15:20:40 -0700] [46657] [INFO] Listening at: http://127.0.0.1:8000 (46657)
[2024-06-04 15:20:40 -0700] [46657] [INFO] Using worker: sync
[2024-06-04 15:20:40 -0700] [46728] [INFO] Booting worker with pid: 46728
/home/jsirois/dev/pex-tool/pex/app.py:2: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['pex.fetcher (/home/jsirois/.pex/unzipped_pexes/1f919528d7942b66beb34e5b56a696a21ae82673/.bootstrap/pex/fetcher.py)'].
monkey.patch_all()
:; curl http://127.0.0.1:8000
Hello, World!
from pex.
The warning turns out to be a red-herring. Although pex/fetcher.py is included in the PEX .bootstrap/
, it is unused; so gevent is missing the mark here. Nonetheless, the .bootstrap/
should only contain Pex code needed to boot a PEX file and so pex/fetcher.py
should go.
from pex.
Ok, pex/fetcher.py
can actually be used at runtime in the case of a --venv
PEX, although a re-exec happens after that, clearing state and that use also does not call install_pip
which is the only case where an URLFetcher
might be used. As such, just making the import ssl
lazy is enough.
from pex.
@jsirois thanks a lot for the quick response and explanation. The new version will help us moving forward with new pants versions too. Appreaciate it 🙏🏽
from pex.
Ok @mariano-filipe the fix is released:
from pex.
Related Issues (20)
- ValueError: invalid literal for int() with base 10 during pex build HOT 5
- How to bootstrap external pex files within running Python interpreter HOT 23
- Finalize Python 3.13 support HOT 1
- Build fails/incomplete on requirements.txt schema not followed correctly HOT 9
- Allow subsetting a PEX lockfile in PEX format, not just pip HOT 12
- Support for pip-compile generated requirements with hashes HOT 8
- bdist_pex called from tox fails with python 3.12 HOT 7
- Regression of artifact URL due to change since pip 23.3 HOT 12
- `pex3 lock export` can turn VCS requirements into PyPI ones, resulting in hash failures HOT 3
- A way to configure sys.executable flags at PEX runtime HOT 8
- Add support for `--override`ing transitive dependencies. HOT 1
- Add `--provided`: like `--exclude`, but require the excluded project is available at boot time.
- "Resolving wheels disallowed" error when using `--lock` and `--only-binary` HOT 3
- Add more distribution metadata parsing context to failures.
- Add support for Pip 24.2 / statically linked musl libc CPythons
- Adding support to have all command line flags respected via environment variables HOT 6
- How does pex resolve defaut `--pip-version` HOT 13
- Support `--scie-pbs-flavor`. HOT 3
- Support `--scie` for PyPy.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pex.