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

Error on pip warning message #270

Closed
kgartland-rstudio opened this issue Jul 21, 2022 · 3 comments · Fixed by #508
Closed

Error on pip warning message #270

kgartland-rstudio opened this issue Jul 21, 2022 · 3 comments · Fixed by #508
Assignees
Labels

Comments

@kgartland-rstudio
Copy link
Contributor

kgartland-rstudio commented Jul 21, 2022

rsconnect-python 1.9.0

While testing the --force-generate flag which pulls all packages from the local environment to create a new requirements.txt file, I hit the following error:

Command:

> rsconnect deploy notebook stock-report-jupyter/stock-report-jupyter.ipynb stock-report-jupyter/quandl-wiki-tsla.json.gz --force-generate -n dogfood

Error:

2022/07/21 17:10:32.382291755 ERROR: Invalid requirement: [notice] A new release of pip available: 22.1.2 -> 22.2
2022/07/21 17:10:32.382303162 __main__.py: error: no such option: ->
2022/07/21 17:10:32.382312497
2022/07/21 17:10:34.603929017 pip install failed with exit code 1
Build error: exit status 1
An error occurred while building the content (build-failed-error)
Error from Connect server: exit status 1
Error: Task exited with status 1

It seems pip is throwing a warning message about upgrading to the latest version but we're trying to include that line of output as an option when installing pip on Connect.

When upgrading to pip 22.2 locally, the deployment succeeded.

Full Logs
> rsconnect deploy notebook stock-report-jupyter/stock-report-jupyter.ipynb stock-report-jupyter/quandl-wiki-tsla.json.gz --force-generate -n dogfood
    Warning: the existing manifest.json file will not be used or considered.
    Warning: the existing requirements.txt file will not be used or considered.
Validating server... 	[OK]
Validating app mode... 	[OK]
Making bundle ... 	[OK]
Deploying bundle ... 	[OK]
Saving deployed information... 	[OK]
Building Jupyter notebook...
Bundle created with Python version 3.8.2 is compatible with environment Local with Python version 3.8.1 from /opt/Python/3.8.1/bin/python3.8
Bundle requested Python version 3.8.2; using /opt/Python/3.8.1/bin/python3.8 which has version 3.8.1
2022/07/21 17:10:08.228195803 Running on host: dogfood02
2022/07/21 17:10:08.228315936 Working directory: /opt/rstudio-connect/mnt/app
2022/07/21 17:10:08.228330386 Environment will be built with Python "3.8.1 (default, Jan  8 2020, 22:29:32)  [GCC 7.3.0]" at /opt/Python/3.8.1/bin/python3.8
2022/07/21 17:10:08.228807924 Running as user: rstudio-connect
2022/07/21 17:10:08.241786468 Skipped packages: appnope==0.1.3, setuptools==62.3.2
2022/07/21 17:10:08.241806526 Creating environment: 3NtYi3L4jKO4kwvjNQidxA
2022/07/21 17:10:17.158082840 Collecting pip
2022/07/21 17:10:17.258739532   Downloading https://files.pythonhosted.org/packages/9b/9e/9e0610f25e65e2cdf90b1ee9c47ca710865401904038558ac0129ea23cbc/pip-22.2-py3-none-any.whl (2.0MB)
2022/07/21 17:10:17.819286446 Collecting setuptools
2022/07/21 17:10:18.356470431   Downloading https://files.pythonhosted.org/packages/a4/53/bfc6409447ca024558b8b19d055de94c813c3e32c0296c48a0873a161cf5/setuptools-63.2.0-py3-none-any.whl (1.2MB)
2022/07/21 17:10:18.489009944 Collecting wheel
2022/07/21 17:10:18.530761175   Downloading https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
2022/07/21 17:10:18.613279278 Installing collected packages: pip, setuptools, wheel
2022/07/21 17:10:18.613615209   Found existing installation: pip 19.2.3
2022/07/21 17:10:19.442279857     Uninstalling pip-19.2.3:
2022/07/21 17:10:19.518393362       Successfully uninstalled pip-19.2.3
2022/07/21 17:10:26.893118906   Found existing installation: setuptools 41.2.0
2022/07/21 17:10:27.104934960     Uninstalling setuptools-41.2.0:
2022/07/21 17:10:27.241035680       Successfully uninstalled setuptools-41.2.0
2022/07/21 17:10:30.322280756   Found existing installation: wheel 0.34.2
2022/07/21 17:10:30.323774046     Not uninstalling wheel at /opt/Python/3.8.1/lib/python3.8/site-packages, outside environment /opt/rstudio-connect/mnt/app/python/env
2022/07/21 17:10:30.323847414     Can't uninstall 'wheel'. No files were found to uninstall.
2022/07/21 17:10:30.582529260 Successfully installed pip-22.2 setuptools-63.2.0 wheel-0.37.1
2022/07/21 17:10:32.382227638 Usage: __main__.py [options]
2022/07/21 17:10:32.382240027
2022/07/21 17:10:32.382291755 ERROR: Invalid requirement: [notice] A new release of pip available: 22.1.2 -> 22.2
2022/07/21 17:10:32.382303162 __main__.py: error: no such option: ->
2022/07/21 17:10:32.382312497
2022/07/21 17:10:34.603929017 pip install failed with exit code 1
Build error: exit status 1
An error occurred while building the content (build-failed-error)
Error from Connect server: exit status 1
Error: Task exited with status 1
@pfizzy
Copy link

pfizzy commented Aug 2, 2022

I am also hitting this error message, even when supplying my own requirements.txt. Not an administrator on our installation, so this is now a blocker as I cannot deploy a new release of my code.

I believe the solution is to set the environment variable PIP_DISABLE_PIP_VERSION_CHECK=1 which should prevent pip from checking and emitting any kind of information that is getting parsed. Alternatively, can provide the command line argument to pip --disable-pip-version-check

@kgartland-rstudio
Copy link
Contributor Author

@pfizzy, can you share your requirements.txt file and the error you're hitting?

I was under the impression that it's only happening when giving Connect instructions to install pip, which shouldn't be needed. If pip is included in your requirements.txt file, you should be able to exclude that.

@pfizzy
Copy link

pfizzy commented Aug 2, 2022

Whoops, realized my error. I was attempting to move the build context into my source sub directory, because I had been compiling a fairly extensive list of --excludes, which I knew would eventually be unmaintained. However, my requirements.txt is in the parent directory, so even though it exists, it was not being sent over to Connect, and a requirements.txt file was being generated on the fly.

The hitch is that I am running my deployment commands through a script which was capturing stderr and not stdout. The Connect build logs are routed to stderr, but the Warning: Capturing the environment using 'pip freeze'. Consider creating a requirements.txt file instead. message was sent to stdout, and hence I was ignorant of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants