Skip to content
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

Python requirements.txt file on Windows includes local file paths #494

Closed
slodge opened this issue Mar 26, 2021 · 5 comments
Closed

Python requirements.txt file on Windows includes local file paths #494

slodge opened this issue Mar 26, 2021 · 5 comments
Assignees

Comments

@slodge
Copy link

slodge commented Mar 26, 2021

I'm using python inside connect for the first time this week - so apologies if these are "newbie" errors.

I'm working on Windows desktop and discovering that the generated pip requirements.txt file includes some nasty local file paths which cause pip on the server to fail.

For example, using a standard notebook like https://github.com/sol-eng/python-examples/tree/master/rmarkdown-notebook

This causes rsconnect::writeManifest("reticulate", "FirstAttempt.Rmd") to generate a requirements.txt file:

certifi==2020.12.5
numpy @ file:///D:/bld/numpy_1610324703282/work
pandas @ file:///D:/bld/pandas_1607423921518/work
python-dateutil==2.8.1
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1612179539967/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1590081179328/work
wincertstore==0.2

This will not upload to the server unless I manually edit it down to:

certifi==2020.12.5
numpy
pandas
python-dateutil==2.8.1
pytz
six
wincertstore==0.2

I think this is somehow related to pypa/pip#8174 - it seems like the miniconda distribution that RStudio installed has pip --version of pip 21.0.1

For now I'm working around this by manually editing the requirements files.

Is this just a bug in pip? Or is it something rsconnect needs to be aware of too?

@kevinushey
Copy link
Contributor

Do you know whether these packages were installed by pip, or via the conda package repository?

@slodge
Copy link
Author

slodge commented Mar 26, 2021 via email

@jmcphers
Copy link
Member

@mmarchetti Do you know why this might happen?

@mmarchetti
Copy link
Contributor

Yes. Conda leaves metadata hanging around, and pip (as of pip 20.1) picks it up and includes it in the output from pip freeze. See posit-dev/rsconnect-python#166. We've worked around this by using pip list --format=freeze, which omits the metadata paths, but that may change given pypa/pip#8176 and pypa/pip#7157.

Some options here:

  • Update to the latest rsconnect master which has Use pip list --format-freeze instead of pip freeze #475
  • Create a requirements.txt file in the directory being deploy, so that environment inspection is not used.
  • Update to the latest Connect, which should handle this case by stripping those paths on the receiving side.

@hadley
Copy link
Member

hadley commented Feb 21, 2023

Since there hasn't been any follow up in the last few months, and it sounds like there's a good chance this is fixed in main, I'm going to close this issue. Happy to reopen if there's more work to be done.

@hadley hadley closed this as completed Feb 21, 2023
xehu added a commit to Watts-Lab/team_comm_tools that referenced this issue Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants