-
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
Poetry on fresh install thinks virtual env is in "/lsiopy", despite "poetry config virtualenvs.in-project true" that should force .venv in project folder #9931
Comments
wasn't that what you wanted all along? what's the problem? |
Thanks for the fast reply. Yes, in theory that is what I want. |
well it's your computer, I expect you have a broken virtual environment in /lsiopy. Fix or delete it? |
I tried that before - the folder is long gone. I even tried to manually recreate it, to see if then poetry install works, same result. The following log shows how the folder is /lsiopy; poetry install finds that this directory is not working and installs to .venv (as desired), but the log at the end (poetry show) lists all packages red (e.g. not installed). Step 1: Removal of broken /lsiopy Step 2: Check if /lsiopy still exists
Step 3: Make sure the venvs are put into the project folder Step 4: Checking teh .env path -> should be the project folder but it isn't
Step 5: Trying an install nonetheless. It finds /lsiopy to be broken and correctly installs to .venv
Step 6: Verifying the venv path. Latest with above installation it should be .venv, but it is still /lsiopy
Step 7: Checking if poetry shell at least has the packages. It argues lsiopy is not valid, and recreates .venv, thereby killing the installs from above
Step 8: Checking the packages - they are all not installed.
|
poetry isn't going to be pulling "lsiopy" out of thin air, there is something on your computer pointing at it or using it or whatever. looks like you're on docker, suggest sharing a minimal dockerfile that reproduces this. There's probably a pretty good chance that in the process of trying to construct that repro you will understand what is going on. |
I am using the image: lscr.io/linuxserver/code-server:latest I see in the code of above image that they use the /lsiopy as virtual python environment. When I use their image, at the beginning there doesn't seem to be python installed (hence I install it with the script I shared further above). Looks to me that they use python in their build process, but then don't include it to keep the package lean. What to me is unclear is why poetry looks for venvs (and finds /lsiopy by doing so) in the first place. Since I turned on the below setting, I would have expected it to simply consider the project folder, and nothing else. Any ideas? Update: My take would be that poetry gives priority to the VIRTUAL_ENV variable when chosing which venv to use, and thus in my case - given the VIRTUAL_ENV is present - poetry ignores the .venv present in the project folder, eventhough the setting poetry config virtualenvs.in-project true. Is my understanding correct? If yes, is that desired behavior (or potentially a bug)? Looking at the changelog sentence below, my reading would have been that the VIRTUAL_ENV variable should have no effect in my case, since it is not an activated environment (actually, the /lsiopy is an empty folder). Line 1681 in d9f1914
If the current implementation is as it should be, is there a way to force poetry to use the .venv in the project folder, eventhough a VIRTUAL_ENV variable is present? (Update 2: Isn't that exactly what this PR is about? #9902) |
If there is a bad |
Already done :) I am still surprised though that the setting |
After pondering more about it, I think we might actually have a bug here in poetry. Let me try to expain. Firstly, the changelog above says…
… but that doesn‘t seem to be the case. While in my container said VIRTUAL_ENV is present, the virtual env is not activated. Nonetheless, poetry tries to start in that dir, contradicting the changelog. Of course the changelog entry dates back sometime, and the statement is not accurate anymore. Second reason why I believe there is a bug, is because poetry acts inconsistently. It sees that the VIRTUAL_ENV is set, and then immediately argues that venv is invalid (and does not seem to activate, and hence fails to install). Then it tries to local project folder (due to virtualenvs.in-project true) and here recreates it (despite being a perfectly valid venv) and then activates it. So the inconsistency is that the VIRTUAL_ENV it seeems not to try to activate/recreate, while the own it does. I am not that bothered about the second discrepancy; but if the expected behavior -as the changelog suggests- is to only consider active VIRTUAL_ENV then I think this is a bug since in my case the env is not active and thus VIRTUAL_ENV should be entirely disregarded |
the virtual env is activated, that is what it means to have a |
I am trying to make sense of this statement:
I am not activating that venv. Sure, they set the venv variable to the /lsiopy dir, but according to the last sentence, unless I activate it myself, it should not be active. Doesn‘t this contradict with your statement that the env variable itself indicates that the venv is active? Is there a way to verify if the venv is actually active (eg to verify that the env variable is a reliable indicator)? My reading from above would be that they create the env variable, but its not a representation of whether the venv is active or not |
the only thing that activating a virtual environment does is to set that variable and tweak the path. A virtual environment is active exactly when |
Thank you- i‘m following up with the code server team. Appreciate your help, expertise and patience with this issue (and me 🙂) |
They dont recommend installing software in their containers, which I was doing. rather, use their mods. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
I am desperately trying to get poetry to run, and have create a installation script (setup.sh, below) that is supposed to install everything on a clean slate.
However, despite the setting to create the virtual environment in the project folder ("Test/.venv"), for some reason the virtual env keeps pointing to a folder called "/lsiopy", for which poetry complains that the Virtual Env is not valid (output below).
I've tried cleaning caches, reinstalling everything a hundred times, but the result is the same.
I think I am staring at something very obvious - any help is appreciated.
Thank you.
Workarounds
none
Poetry Installation Method
curl -sSL https://install.python-poetry.org | python3.10
Operating System
Ubuntu 24.04.1 LTS
Poetry Version
1.8.5
Poetry Configuration
Python Sysconfig
Bash Session
Example pyproject.toml
TOML
Poetry Runtime Logs
I am adding the poetry install logs, which show at the very beginning the output that the venv /lsiopy is broken (which is expected, since /lsiopy should not be used in the first place, but the .venv inside the cloudbackup folder)
Bash Session
The text was updated successfully, but these errors were encountered: