-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Upgrade pip/setuptools in venv to versions from base environment #740
Conversation
548fc81
to
3a67b0f
Compare
Any reason it's not merged? @sdispater |
3a67b0f
to
1900033
Compare
We are having this problem right now, and are not sure what we can do at least as a stopgap fix. For some weird reason Poetry decided that from now on, it installs everything with |
Also having this issue. Can this please be merged? @sdispater ? |
I could also use this fix. Is there any issue causing this to not be merged @sdispater ? |
Current helper script to resolve virtualenv issues: #!/bin/bash
echo "--- Checking appropriate prerequisites are installed."
# Check correct version of Python
python -V | grep 3.
if [ $? -ne 0 ]
then
echo "Please ensure you have Python 3.6 activated. Pyenv is recommended."
exit 1
fi
# Check Poetry installed
poetry --version | grep 0.12
if [ $? -ne 0 ]
then
echo "--- Poetry not detected, installing..."
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
fi
# Do dry run to create virtual environment
echo "--- Using Poetry to create virtual environment"
poetry install --dry-run -q
# Activate created virtual environment
echo "--- Activating virtual environment"
VIRTUAL_ENV=$(poetry run python -c "import os; print(os.environ['VIRTUAL_ENV'])")
echo "Virtual environment path is $VIRTUAL_ENV"
source $VIRTUAL_ENV/bin/activate
if [ $? -ne 0 ]
then
echo "Could not activate the virtual environment!"
exit 2
fi
echo "--- Updating pip and setuptools"
pip install -q --upgrade pip setuptools
deactivate
# Do the final install
echo "--- Installing dependencies"
poetry install Edit: since realised you can fix this just by running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asodeur Thanks for contributing to poetry! Sorry for the delay in reviewing this.
Could you rebase this into one commit? I'll look at this soon.
# Requirements | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
[tool.poetry] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats changing in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be any changes, looks like somehow Windows line endings slipped in. I'll revert this.
"python", "-m", "pip", "install", "--upgrade", "pip=={}".format(pip_version) | ||
) | ||
the_venv.run( | ||
"python", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would mean that the creation of new environments would require internet access. I think we need to either
- solve this in the
ensurepip
library in a way that works without internet or - have this be hidden behind a command line flag /setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll check what can be done. Since we are trying to update to the version available in the base environment there should be some way to get along w/o internet connection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it seems like there should be a way but the discussion on the python bug tracker seems to think its trickier than it sounds. I hope you find a way though! I wonder if you should be making a pull request into ensurepip
instead though.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I believe this is still an issue for some dependencies. I have the use the following in my builds:
Tensorflow, for example, has minimum pip requirements: https://www.tensorflow.org/install/pip Understand however if this is beyond the scope of what poetry is attempting to resolve. |
In the meantime poetry has switched to virtualvenv for creating the venv's. This will make sure to get the latest pip. Thanks a lot for your contribution anyway 👍 fin swimmer |
Closed by #2666 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Check List
Pedestrian fix for #732.
This PR upgrades pip/setuptools to the versions found in the base environment during
venv
creation. Hence, if pip/setuptools versions in your base environment can install a package,poetry
can install it into the created virtual environment.No attempt is made to resolve any build requirements declared in either
setup.py/setup_requires
orpyproject.toml/[build-system]
.