You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Always use `python3` and not `python`. This could resolve to a python2 installation.
103
103
1. Use `which -a python3` to figure out ALL `python3` binaries that could resolve from `PATH` environment variables and in which order.
@@ -150,9 +150,9 @@ You definitely want to create virtual environments only in the same folder as yo
150
150
poetry config virtualenvs.in-project true --local
151
151
```
152
152
153
-
## Troubleshooting
153
+
## Poetry Troubleshooting
154
154
155
-
99% of problems are resolved by resetting a borked virtual environment.
155
+
1. 99% of problems are resolved by resetting a borked virtual environment.
156
156
157
157
```sh
158
158
rm -rf .venv && rm poetry.lock
@@ -164,6 +164,22 @@ Then:
164
164
poetry lock && poetry install
165
165
```
166
166
167
+
2. When `deactivate`ing a poetry shell sometimes you need to `unset POETRY_ACTIVE` to clean the environment variables.
168
+
169
+
3. Issues with `poetry` across multiple version of Python, `poetry` is installed _**per Python version**_.
170
+
171
+
Use the following when in doubt:
172
+
```sh
173
+
python3 -m install -U poetry pip
174
+
python3 -m poetry shell
175
+
```
176
+
1. **The problem**: When I run `poetry` on the commandline it resolves based on my `PATH`
177
+
2. So `python3 --version` could show `3.9`, but `poetry` is installed in my `3.8`
178
+
3. `poetry` will create a virtual environment based on the `python3` interpreter that it is being run in.
179
+
4. `python3 -m poetry` uses the exact version of `poetry` that is relative to the same `python3` you are expecting because you are using _module mode_ (`-m`).
180
+
5. This is part of the reason you upgrade `pip` using `python3 -m pip install -U pip` to make sure you are updating the same `pip` as your target `python3` interpreter.
181
+
6. This is why I only activate `pyenv` on demand to have least magic on my `PATH` at any given time.
0 commit comments