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

Not properly detecting IPython usage inside virtualenvs created via uv venv #14377

Open
joshburnett opened this issue Mar 28, 2024 · 1 comment

Comments

@joshburnett
Copy link

I used the uv tool to create my venv and also to install ipython into it (via uv pip install ipython). When starting ipython I see the following warning:

C:\Users\jburnett1\Code\coordinates data analysis\.venv\Lib\site-packages\IPython\core\interactiveshell.py:937: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
  warn(

But if I examine the location of the IPython module it's definitely inside the currently activated venv:

import IPython
IPython
Out[4]: <module 'IPython' from 'C:\\Users\\jburnett1\\Code\\coordinates data analysis\\.venv\\Lib\\site-packages\\IPython\\__init__.py'>
import sys
sys.executable
Out[6]: 'C:\\Users\\jburnett1\\Code\\coordinates data analysis\\.venv\\Scripts\\python.exe'

I did find this very old issue which seemed to have a similar root cause, but the fix doesn't apparently work with the way that uv creates venvs & installs packages into them.

My version info:

sys.version
Out[7]: '3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]'
IPython.__version__
Out[8]: '8.22.2'

This is w/ uv version 0.1.6.

@joshburnett
Copy link
Author

joshburnett commented Mar 28, 2024

Checking further, it appears that this issue only shows up when launching the python console within the PyCharm IDE (I'm running the latest Community Edition). When I launch IPython from the terminal I do not see the warning.

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

No branches or pull requests

1 participant