-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use base_prefix to detect virtual env #2566
Conversation
Is this not an issue with Spyder messing with the environment? |
IPython makes use of the VIRTUAL_ENV environment variable and Spyder wants to fool IPython. Maybe the fix should be at Spyder? |
@pijyoi Thanks for the pointer, that gives good information. I do not know whether we should fix this at the spyder or pyqtgraph side. I created spyder-ide/spyder#20273 to get input from the spyder devs. The PR here is simple, so if there are no downsides and there is no easy solution at the spyder side I would be in favor of this option. |
Hi @eendebakpt I'm ok merging this change, but I would request you add a comment with a link to the issue in spyder, so that future people maintaining the library don't have to scratch their heads as to why this change was made, and in turn can track if the other issue was ever fixed (and if it is fixed/addressed, when can this patch be removed from pyqtgraph). EDIT: btw thanks for creating the issue w/ the Spyder repo; hopefully there will be an explanation there, ccordoba12 (intentionally not tagging to minimize notification spam) is a friend of the project :) |
@j9ac9k No response on the spyder github issue yet, but I added links to the issues in the comments. |
Thanks, that's perfect! |
See the discussion in #1860.
Detect presence of a virtual enviroment using
sys.prefix != sys.base_prefix
. This is more robust than a check on the environment variableVIRTUAL_ENV
.Fixes #1052
@j9ac9k @pijyoi
A minimal example (using Windows):
python -c "import os; print(os.environ.get('VIRTUAL_ENV'))"
. The output shows the location of the virtualenvpip install spyder
)spyder
). In the Spyder console window runimport sys; print(sys.prefix)
. The output is the location of the virtual environment, which shows the console session in spyder is indeed running the virtual environment.import os; print(os.environ.get('VIRTUAL_ENV'))
. The output isNone
. So the original check does not work in this caseimport sys; sys.prefix != sys.base_prefix
. The output isTrue
Other Tasks
Bump Dependency Versions
Files that need updates
Confirm the following files have been either updated or there has been a determination that no update is needed.
README.md
setup.py
tox.ini
.github/workflows/main.yml
and associatedrequirements.txt
and condaenvironemt.yml
filespyproject.toml
binder/requirements.txt
Pre-Release Checklist
Pre Release Checklist
__init__.py
CHANGELOG
primarily using contents from automated changelog generation in GitHub release pagePost-Release Checklist
Steps To Complete
.dev0
to__version__
in__init__.py