-
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
"expected string or bytes-like object" on poetry install #3628
Comments
There are more similar reports: |
We should try to narrow it down, maybe there is a dependency somewhere with packaging issues. |
Some extra information:
So there is something very specific to a runner that is independent from the docker image that triggers this error. |
I see. This is good info. This changes my perspective on this issue. |
Perhaps this could be a broken cache entry somewhere? |
I'm adding @netcaptors here; he is a member of the team that manages the github runners and has more insight into their configuration than I have. |
I'm out of my depth on this. I'll ping @stephsamson and @finswimmer maybe they'll be able to give more insight or redirect to other maintainers. But you seem to say it's rather new behaviour, although there was no new poetry release in a while, right? |
This particularly error is new for us today as far as I can tell. I expect that there is something in the environment that poetry needs to deal with that changed and triggered this error. |
Could it be something new in the container image? |
Doubtful, we had not done a rebuild of our docker image at the moment this error started occurring as far as I know. |
As magically as this error started appearing, it seems to have disappeared today. As far as I know the only change that happened is that |
I saw this issue locally today on my mac. I used poetry 1.1.4 and it worked for me until today, for some reason, I tried revert everything to a specific git commit I confirmed working recently (delete the entire folder and fetch from git again, so it doesn't seem to me a permission issue), but the same error was reported. |
I got the same problem. I dropped into PDB and tried to track it down.
Then if I run this in PDB: I get for my specific
Note the Now let's find the culprit:
For some reason Interestingly enough it's also the only dependency of my project dependencies which upgraded when I last ran Hope this helps. EDIT: Extra info: EDIT 2: EDIT 3: |
I was also having the same problem. In my case, I ran MaikuMori's third solution, removing Update: |
We also get those |
First, I start with a
I try to reproduce the problem after a fresh installation of poetry-1.1.5:
Now, I inspect the newly-created virtual environment's
They seem to be empty, even the
Is this intentional? I did all of this using previous poetry versions (1.1.0 and 1.1.4 if I remember correctly). I see the same behavior. I see empty site-packages if I use:
site-packages are populated if I use the system python. |
The rubber ducky problem solving method has been demonstrated. Writing down my problem in #3628 (comment) has helped a lot in framing it. This is what I did to get around the problem of empty site-packages
That should do it. |
I've stumbled into the same issue today, seemingly out of the blue. This morning I did a system upgrade ( I had used pyenv to use Python 3.7.8. I tried clearing the cache and recreating the venv, but no luck. I then tried the system Python to create the venv (Python 3.9.2), but same thing. I could run I then tried installing another project, which worked fine. Then I tried installing the old project (https://github.com/ActivityWatch/aw-client) again, which gave the output:
I assume one of these dependencies are to blame, but I don't know which (and yes, they are all up to date). Edit: Weirdly enough the same issue doesn't seem to occur in CI (ActivityWatch/aw-client#56), so perhaps one of the dependencies aren't to blame after all? Or it's just that Edit: The issue ended up being the Found them all with: |
I'm not sure if this is useful, but I was having this issue when deploying via Docker to Digital Ocean App Platform. I changed my Docker image base as such: from:
to:
|
In my case poetry fails with a similar error when I'm trying to add a package:
|
I am not sure if it has anything to do with what you guys are experiencing but after get this problem localy in serveral projects and find this issue I started to debug poetry and found out that the issue was happening because, for some reason, I had a .egg-info directory. I could than see that poetry was checking on it for installed packages and there was a
Reproducing the error: (I dont know how it would behave with a valid .egg-info directory)
I hope it helps. |
I have a minimal reproduction pyproject.toml file that may be the same issue. I was trying to add a spacy model directly to my deps (the en-core-web-sm line below), but I ultimately had to specify it as a URL dep to get poetry.lock to generate.
Hope this helps! |
For some of us, it is directly due to anaconda. |
Did you try reinstalling poetry, making sure your anaconda environment wasn’t active during install? I’d use the same python binary whenever you run poetry commands. |
It looks like it triggers the bug, but there are other triggers too. For some reason, the download is corrupted, which then corrupts the cache. Without clearing the cache, it will continue to install the corrupted version. And by corrupted I mean the |
For me it was related to the .venv folder created by poetry: 👉 Deleting that folder and running |
I'm using
worked for me. |
What worked for me: |
Even after deleting the TypeError
expected string or bytes-like object |
Try deleting the poetry.lock also before the poetry install and update |
Because we have as deps some software available only in conda and not pypi (and they won't be), but we can still use a big part without the need for a conda environment. @aalok-sathe You are running poetry inside a conda environment ? If yes, you can try to run the following snippet: from os import environ, remove, rmdir
from shutil import rmtree
from sys import version_info
import importlib_metadata as metadata
MODULES_PATH = [
f"{environ['CONDA_PREFIX']}/lib/python{version_info.major}.{version_info.minor}/site-packages",
f"{environ['HOME']}/.local/lib/python{version_info.major}.{version_info.minor}/site-packages",
]
if __name__ == '__main__':
for pkg in filter(lambda a: a.metadata["name"] is None, metadata.distributions(path=MODULES_PATH)):
print("Erasing", pkg._path)
if pkg._path.is_dir():
rmtree(pkg._path)
else:
remove(pkg._path) (I've already posted it, but can't recall in which issue). |
The In my case, I ran into the issue in the following combination:
I later realize doing |
Still getting this error on Poetry 1.1.13. I have no |
The fix is in Poetry 1.2b2 -- Poetry 1.1.x is not seeing releases as we work up to a full release of 1.2. |
Yup. Discovered that after commenting about your poor documentation. For me, version 1.2.0b2 found multiple |
Poetry is free software developed by volunteers without any expectation of warranty. I am sorry that you had to struggle to find the relevant documentation, and I will make a note of improving it before release. Note that we are still in beta for 1.2 and things are therefore still in flux. Please refrain from using an unnecessarily hostile or confrontational tone.
I'm glad you were able to sort the issues out. Please test 1.2 in your environment and open issues for any regressions or deficiencies (like documentation) you may find. |
Apologies, my frustration came out and that was unprofessional. I appreciate your help. Thank you for responding so quickly. |
I tried using 1.2.0rc1 and it fails a different way so I can't tell if it fixes the name problem. It's in a similar area of code and has the same kind of feel, so I figured I'd at least mention it here since I really don't have time to open a whole new ticket:
That assertion does behave helpfully because it stops everything dead in its tracks. Is it really that fatal? I would think it would be less disruptive to merge lines 343 and 344 as
possibly adding a log.warning if you want someone to know about the problem? Putting |
if you care then raise a new ticket and say how to reproduce, no point in making updates in unrelated and already-closed issues |
Definitely do open a new issue if you can reproduce this consistently in a container/VM. With regard to assert in production code, it's there for typing purposes and is very helpful for catching this kind of bug. It should be impossible for a None to sneak in there according to the intention of the authors of that section of code, and yet it happened -- this is why typing (and typing asserts) are very helpful for writing robust Python code. |
I'll try to open a ticket if I get time, but as you probably know, it takes time to do a good ticket that isn't overly complicated. It helps to know that you think this is not a known problem, since that makes the investment in time seem more justified. Thanks. |
Still experience this :( |
This is a closed issue that could refer to a wild assortment of different root causes -- if you are running into this, please narrow it down to a minimal reproduction and open an issue so we can try to understand how to solve it. |
-vvv
option).python:3.8-slim-buster
(see below for Dockerfile)Issue
When I run
poetry install
in a private GitHub runner on an GHES installation I started getting an error (see further below for full output):Debug output
Dockerfile for base docker image
The text was updated successfully, but these errors were encountered: