Unable to install using python 3 on clean Ubuntu 18.04 image
See original GitHub issueI am trying to install poetry as early as possible in a clean docker run -it ubuntu:18.04
interactive session:
apt update
apt install python3 curl
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
at this point, poetry installed but won’t run because there’s no “python” on the system; only python3. so I made a symlink and tried again:
poetry --version
Traceback (most recent call last):
File "/root/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/root/.poetry/lib/poetry/_vendor/py3.6/importlib_metadata/__init__.py", line 92, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
from . import file_base
File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
I retried the steps using apt install python3-pip
followed by python3 -m pip install poetry
instead of the bootstrap script, but I get the same error when trying to run poetry.
What am I missing exactly?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:17 (11 by maintainers)
Top Results From Across the Web
docker - Can I install python 3.7 in ubuntu 18.04 without ...
This would fail as python3.7-pip doesn't seem to exist; only python3-pip does, which is what installs python 3.6 for some reason. I tried...
Read more >How to upgrade to Python 3.10 on Ubuntu 18.04 and 20.04 LTS
Step 1: Add the repository and update · Step 2: Install the Python 3.10 package using apt-get · Step 3: Add Python 3.8...
Read more >"Unable to locate package" while trying to install ... - Ask Ubuntu
First, check if the package actually does exist: Go to packages.ubuntu.com with a web browser. Scroll down to "Search package directories".
Read more >How to Install Pip on Ubuntu 20.04 & 18.04 [Super Easy Way]
Python 2 is deprecated and not available in Ubuntu 20.04 and higher versions. You can only install PIP3. First, make sure that Python...
Read more >How to Install Pyenv on Ubuntu 18.04 - Liquid Web
Now for further verification, change the version of Python to 3.8.3 and drop into a python shell. root@ubuntu:~# pyenv global 3.8.3 root@ubuntu ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@finswimmer thanks for double-checking; I already knew that python 2 worked to install it. The documentation is clear that it doesn’t matter which version of python is used to install poetry, so the scenario outlined in my original post (with python 3) is clearly an issue.
Using python 2 is not acceptable in my case; it’s simply not available on our production images and our
python
executable launches py3. Poetry absolutely have to be able to work in a python2-less environment.Hello,
I try to reproduce the problems mentioned here, by installing a fresh ubuntu 18.04 in a virtual machine. After doing this (installing the “minimal” variant), I ended up with a system where a
python3
exists but nopython
. At the moment,poetry
expects that there is apython
within the path. It doesn’t matter if it links to apython2
orpython3
. So I install python2 bysudo apt-get install python
. After that it looks like thisFor installing
poetry
,curl
is needed:Then:
Now let’s create two poetry projects. One that should use
python2
and onepython3
.The
pyproject.toml
looks like this:Now install the project:
And you’re done. Whenever running a
poetry
command you will receive a warning like this:It’s a warning and AFAIK you can ignore it.
Now let’s see what happens for a project uses
python3
. Copy the abovepyproject.toml
to a new folder calledproject_python3
. Change thename
in this file to match the folder name and changepython = "^2.7"
topython = "^3.6"
.Run
poetry install
and you may receive an error message that you need to installpython3-venv
. Ok, let’s do it:Unfortunately poetry left a broken venv behind, we had to remove before trying again.
and
To summarize:
python
python
links topython2
orpython3
python
there should bepython2
andpython3
in your path, if you like to use different python3 versions in different project. Becausepoetry
tries the one or the other if the version ofpython
doesn’t match the project’s python versionpython3-venv
. But poetry will complain about it if needed.fin swimmer