Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #269807 > unrolled thread

Installing a python package with pipx

Started byRichmond <dnomhcir@gmx.com>
First post2024-06-01 18:20 +0200
Last post2024-06-02 14:50 +0200
Articles 18 — 2 participants

Back to article view | Back to linux.debian.user


Contents

  Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-01 18:20 +0200
    Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-01 18:30 +0200
      Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-01 18:50 +0200
        Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-01 18:50 +0200
          Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-01 19:20 +0200
            Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-01 19:50 +0200
              Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-01 22:10 +0200
                Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-01 22:40 +0200
                  Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-01 23:10 +0200
                    Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-01 23:30 +0200
                      Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-02 00:00 +0200
                        Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-02 00:10 +0200
                          Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-02 13:50 +0200
                          Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-02 14:00 +0200
                            Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-02 14:10 +0200
                              Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-02 14:30 +0200
                                Re: Installing a python package with pipx Richard <rrosner5@gmail.com> - 2024-06-02 15:00 +0200
                              Re: Installing a python package with pipx Richmond <dnomhcir@gmx.com> - 2024-06-02 14:50 +0200

#269807 — Installing a python package with pipx

FromRichmond <dnomhcir@gmx.com>
Date2024-06-01 18:20 +0200
SubjectInstalling a python package with pipx
Message-ID<IKzCx-htRw-7@gated-at.bofh.it>
I have been trying to install this:

https://pypi.org/project/musicpy/#description

with not much success.

I have done these:

sudo aptitude install pip
sudo aptitude install pipx
pipx ensurepath
pipx install --include-deps musicpy

(logged out and in to get updated PATH)

 pipx run musicpy
'musicpy' executable script not found in package 'musicpy'.
Available executable scripts:

I think it is installed, but how do I run it?

[toc] | [next] | [standalone]


#269808

FromRichard <rrosner5@gmail.com>
Date2024-06-01 18:30 +0200
Message-ID<IKzMd-htVu-1@gated-at.bofh.it>
In reply to#269807

[Multipart message — attachments visible in raw view] — view raw

If you haven't closed the terminal window/logged out, you need to run
source .bashrc. Running pipx ensurepath should have said something like
that.

Richard

On Sat, Jun 1, 2024, 18:10 Richmond <dnomhcir@gmx.com> wrote:

> I have been trying to install this:
>
> https://pypi.org/project/musicpy/#description
>
> with not much success.
>
> I have done these:
>
> sudo aptitude install pip
> sudo aptitude install pipx
> pipx ensurepath
> pipx install --include-deps musicpy
>
> (logged out and in to get updated PATH)
>
>  pipx run musicpy
> 'musicpy' executable script not found in package 'musicpy'.
> Available executable scripts:
>
> I think it is installed, but how do I run it?
>
>

[toc] | [prev] | [next] | [standalone]


#269809

FromRichmond <dnomhcir@gmx.com>
Date2024-06-01 18:50 +0200
Message-ID<IKA5z-hu5f-1@gated-at.bofh.it>
In reply to#269808
Richard <rrosner5@gmail.com> writes:

> If you haven't closed the terminal window/logged out, you need to run
> source .bashrc. Running pipx ensurepath should have said something
> like that.

Yes, I did this:
>    
>     (logged out and in to get updated PATH)

[toc] | [prev] | [next] | [standalone]


#269810

FromRichard <rrosner5@gmail.com>
Date2024-06-01 18:50 +0200
Message-ID<IKA5z-hu5f-3@gated-at.bofh.it>
In reply to#269809

[Multipart message — attachments visible in raw view] — view raw

Looking at the package, no wonder it fails. musicpy doesn't contain
anything that can be executed. So pipx run can't work for obvious reasons.
You'll have to install it with pipx install and use it in a python script.

https://pypi.org/project/musicpy/

Richard

On Sat, Jun 1, 2024, 18:40 Richmond <dnomhcir@gmx.com> wrote:

> Richard <rrosner5@gmail.com> writes:
>
> > If you haven't closed the terminal window/logged out, you need to run
> > source .bashrc. Running pipx ensurepath should have said something
> > like that.
>
> Yes, I did this:
> >
> >     (logged out and in to get updated PATH)
>
>

[toc] | [prev] | [next] | [standalone]


#269811

FromRichmond <dnomhcir@gmx.com>
Date2024-06-01 19:20 +0200
Message-ID<IKAyB-huz3-1@gated-at.bofh.it>
In reply to#269810
Richard <rrosner5@gmail.com> writes:

> Looking at the package, no wonder it fails. musicpy doesn't contain
> anything that can be executed. So pipx run can't work for obvious
> reasons. You'll have to install it with pipx install and use it in a
> python script.
>
> https://pypi.org/project/musicpy/
>

OK so I have found:

./.local/pipx/venvs/musicpy/lib/python3.11/site-packages/musicpy/musicpy.py

But:

 python3.11
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import musicpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'musicpy'

I guess I have to tell python where to look?

[toc] | [prev] | [next] | [standalone]


#269812

FromRichard <rrosner5@gmail.com>
Date2024-06-01 19:50 +0200
Message-ID<IKB1D-huLk-3@gated-at.bofh.it>
In reply to#269811

[Multipart message — attachments visible in raw view] — view raw

That's the point of venv's. pipx runpip should do the trick. Or the classic
way: source path/to/venv/bin/activate. That way you activate the position
virtual environment (venv) created in that directory with all packages
installed in that venv.

Richard

On Sat, Jun 1, 2024, 19:10 Richmond <dnomhcir@gmx.com> wrote:

> I guess I have to tell python where to look?
>
>

[toc] | [prev] | [next] | [standalone]


#269815

FromRichmond <dnomhcir@gmx.com>
Date2024-06-01 22:10 +0200
Message-ID<IKDd7-hwBE-1@gated-at.bofh.it>
In reply to#269812
Richard <rrosner5@gmail.com> writes:

> That's the point of venv's. pipx runpip should do the trick. Or the
> classic way: source path/to/venv/bin/activate. That way you activate
> the position virtual environment (venv) created in that directory
> with all packages installed in that venv.
>

I got it working by doing:

python3 -m venv .local/pipx/venvs/musicpy/

.local/pipx/venvs/musicpy/bin/python3.11

Then I was able to import musicpy from the python shell.

How bewildering!

Thanks.

[toc] | [prev] | [next] | [standalone]


#269821

FromRichard <rrosner5@gmail.com>
Date2024-06-01 22:40 +0200
Message-ID<IKDG9-hwO3-5@gated-at.bofh.it>
In reply to#269815

[Multipart message — attachments visible in raw view] — view raw

Pretty much just what pipx does.

On Sat, Jun 1, 2024, 22:00 Richmond <dnomhcir@gmx.com> wrote:

>
> I got it working by doing:
>
> python3 -m venv .local/pipx/venvs/musicpy/
>
> .local/pipx/venvs/musicpy/bin/python3.11
>
> Then I was able to import musicpy from the python shell.
>
> How bewildering!
>
> Thanks.
>
>

[toc] | [prev] | [next] | [standalone]


#269823

FromRichmond <dnomhcir@gmx.com>
Date2024-06-01 23:10 +0200
Message-ID<IKE9b-hxfw-1@gated-at.bofh.it>
In reply to#269821
Richard <rrosner5@gmail.com> writes:

> Pretty much just what pipx does.
>

Well I don't know how.

Now I need to run idle in my new environment. I have installed it

.local/pipx/shared/bin/pip install idle

and it is here:

.local/pipx/shared/lib/python3.11/site-packages/idle.py

but I don't know how to run it. I just get errors.

[toc] | [prev] | [next] | [standalone]


#269824

FromRichard <rrosner5@gmail.com>
Date2024-06-01 23:30 +0200
Message-ID<IKEsx-hxnJ-1@gated-at.bofh.it>
In reply to#269823

[Multipart message — attachments visible in raw view] — view raw

A packages documentation is always your best friend:
https://pypi.org/project/idle/

Also, python script isn't a necessarily a standalone executable. And also,
you shouldn't just wildly mix pipx commands with pip commands if you don't
know what you are doing. Either create a venv with python3 -m venv or use
pipx, not both. Once created, stick to these separate paths. And read the
documentation of pipx while you're at it. Sure, venvs are easy to handle,
as you can just delete them and start from scratch, but mixing commands
without knowing what one is doing is just a recipe for desaster.

On Sat, Jun 1, 2024, 23:00 Richmond <dnomhcir@gmx.com> wrote:

> Richard <rrosner5@gmail.com> writes:
>
> > Pretty much just what pipx does.
> >
>
> Well I don't know how.
>
> Now I need to run idle in my new environment. I have installed it
>
> .local/pipx/shared/bin/pip install idle
>
> and it is here:
>
> .local/pipx/shared/lib/python3.11/site-packages/idle.py
>
> but I don't know how to run it. I just get errors.
>
>

[toc] | [prev] | [next] | [standalone]


#269825

FromRichmond <dnomhcir@gmx.com>
Date2024-06-02 00:00 +0200
Message-ID<IKEVz-hxET-1@gated-at.bofh.it>
In reply to#269824
Richard <rrosner5@gmail.com> writes:

> A packages documentation is always your best friend: https://pypi.org
> /project/idle/
>

Yes it makes it look easy there, but:

import idle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".local/pipx/shared/lib/python3.11/site-packages/idle.py", line 4, in <module>
    from layout import *
ModuleNotFoundError: No module named 'layout'



> Also, python script isn't a necessarily a standalone executable. And
> also, you shouldn't just wildly mix pipx commands with pip commands
> if you don't know what you are doing. Either create a venv with
> python3 -m venv or use pipx, not both. Once created, stick to these
> separate paths. And read the documentation of pipx while you're at
> it. Sure, venvs are easy to handle, as you can just delete them and
> start from scratch, but mixing commands without knowing what one is
> doing is just a recipe for desaster.
>

I don't know what I am doing for sure. But I did not wildly mix, I just
kept trying things until I found something which worked. Most things
didn't, and still don't.

[toc] | [prev] | [next] | [standalone]


#269826

FromRichard <rrosner5@gmail.com>
Date2024-06-02 00:10 +0200
Message-ID<IKF5f-hy4Z-1@gated-at.bofh.it>
In reply to#269825

[Multipart message — attachments visible in raw view] — view raw

On Sat, Jun 1, 2024, 23:50 Richmond <dnomhcir@gmx.com> wrote:

> Richard <rrosner5@gmail.com> writes:
>
> > A packages documentation is always your best friend: https://pypi.org
> > /project/idle/
> >
>
> Yes it makes it look easy there, but:
>
> import idle
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File ".local/pipx/shared/lib/python3.11/site-packages/idle.py", line 4,
> in <module>
>     from layout import *
> ModuleNotFoundError: No module named 'layout'
>
That's what I'm talking about. You wildly mix commands together that don't
go together. And whatever is off with your paths. Things of pipx installed
packages should be in .local/bin and .local/shared/pipx. At least on Debian
that's the default. No idea what you did.

>
> > Also, python script isn't a necessarily a standalone executable. And
> > also, you shouldn't just wildly mix pipx commands with pip commands
> > if you don't know what you are doing. Either create a venv with
> > python3 -m venv or use pipx, not both. Once created, stick to these
> > separate paths. And read the documentation of pipx while you're at
> > it. Sure, venvs are easy to handle, as you can just delete them and
> > start from scratch, but mixing commands without knowing what one is
> > doing is just a recipe for desaster.
> >
>
> I don't know what I am doing for sure. But I did not wildly mix, I just
> kept trying things until I found something which worked. Most things
> didn't, and still don't.
>
You are, your last comment is more than proof enough.

You should just remove everything you installed with pipx, create a
separate venv - without using pipx! - and solely work inside it. And don't
touch pipx for anything that's not meant as a standalone CLI  program, like
yt-dlp, speedtest and the sorts. Maybe that way you can't do that much
wrong.

At this point this is hardly a Debian related topic. You should first learn
more about Python venvs and their package managers.

>

[toc] | [prev] | [next] | [standalone]


#269833

FromRichmond <dnomhcir@gmx.com>
Date2024-06-02 13:50 +0200
Message-ID<IKRSO-59B-7@gated-at.bofh.it>
In reply to#269826
Richard wrote:
>
>
> On Sat, Jun 1, 2024, 23:50 Richmond <dnomhcir@gmx.com
> <mailto:dnomhcir@gmx.com>> wrote:
>
>     Richard <rrosner5@gmail.com <mailto:rrosner5@gmail.com>> writes:
>
>     > A packages documentation is always your best
>     friend: https://pypi.org
>     > /project/idle/
>     >
>
>     Yes it makes it look easy there, but:
>
>     import idle
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in <module>
>       File ".local/pipx/shared/lib/python3.11/site-packages/idle.py",
>     line 4, in <module>
>         from layout import *
>     ModuleNotFoundError: No module named 'layout'
>
> That's what I'm talking about. You wildly mix commands together that
> don't go together. And whatever is off with your paths. Things of pipx
> installed packages should be in .local/bin and .local/shared/pipx. At
> least on Debian that's the default. No idea what you did.
>
>
I don't think your assessment is correct, as I have booted opensuse,
where I do not even have pipx installed and have not used it. I did
these commands:

1059  pip install musicpy
 1062  pip install idle

I got the layout error so:

 1065  pip install layout

cured the layout error but then I got a gui error

 1067  pip install gui

There is no such package.

.local/lib/python3.6/site-packages/idle.py", line 26, in <module>
    gui.mainloop()
NameError: name 'gui' is not defined

[toc] | [prev] | [next] | [standalone]


#269834

FromRichmond <dnomhcir@gmx.com>
Date2024-06-02 14:00 +0200
Message-ID<IKS2t-5cT-13@gated-at.bofh.it>
In reply to#269826
OK Back on Debian, I removed the one package installed with pipx, which
was musicpy, then tried to install it with pip, but got this message
which actually tells me to use pipx. (There is no package python-musicpy).

pip install musicpy
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

[toc] | [prev] | [next] | [standalone]


#269835

FromRichard <rrosner5@gmail.com>
Date2024-06-02 14:10 +0200
Message-ID<IKSc9-5vL-3@gated-at.bofh.it>
In reply to#269834

[Multipart message — attachments visible in raw view] — view raw

python3 -m venv venv
source venv/bin/activate
pip install musicpy

That's how its done. Also, complaining here about something that doesn't
even work on other distros and thus can't be a Debian problem doesn't make
that much sense.

Am So., 2. Juni 2024 um 13:50 Uhr schrieb Richmond <dnomhcir@gmx.com>:

> OK Back on Debian, I removed the one package installed with pipx, which
> was musicpy, then tried to install it with pip, but got this message
> which actually tells me to use pipx. (There is no package python-musicpy).
>
> pip install musicpy
> error: externally-managed-environment
>
> × This environment is externally managed
> ╰─> To install Python packages system-wide, try apt install
>     python3-xyz, where xyz is the package you are trying to
>     install.
>
>     If you wish to install a non-Debian-packaged Python package,
>     create a virtual environment using python3 -m venv path/to/venv.
>     Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
>     sure you have python3-full installed.
>
>     If you wish to install a non-Debian packaged Python application,
>     it may be easiest to use pipx install xyz, which will manage a
>     virtual environment for you. Make sure you have pipx installed.
>
>     See /usr/share/doc/python3.11/README.venv for more information.
>
>

[toc] | [prev] | [next] | [standalone]


#269837

FromRichmond <dnomhcir@gmx.com>
Date2024-06-02 14:30 +0200
Message-ID<IKSvv-5Ch-3@gated-at.bofh.it>
In reply to#269835
Richard <rrosner5@gmail.com> writes:


> That's how its done. Also, complaining here about something that
> doesn't even work on other distros and thus can't be a Debian
> problem doesn't make that much sense.

I am not complaining, I am trying to find out how to get it working. And
as pip (and pipx) are debian packages I think it is reasonable to
discuss it on the debian user list.

[toc] | [prev] | [next] | [standalone]


#269839

FromRichard <rrosner5@gmail.com>
Date2024-06-02 15:00 +0200
Message-ID<IKSYx-5MQ-3@gated-at.bofh.it>
In reply to#269837

[Multipart message — attachments visible in raw view] — view raw

If it where an issue with pip or pipx, yes. But as you pointed out
yourself, it's also happening on OpenSuse, so the issue can't be pip or
pipx, but rather either what you are trying to install or your
understanding of it.


Am So., 2. Juni 2024 um 14:20 Uhr schrieb Richmond <dnomhcir@gmx.com>:

> I am not complaining, I am trying to find out how to get it working. And
> as pip (and pipx) are debian packages I think it is reasonable to
> discuss it on the debian user list.
>
>

[toc] | [prev] | [next] | [standalone]


#269838

FromRichmond <dnomhcir@gmx.com>
Date2024-06-02 14:50 +0200
Message-ID<IKSOR-5JD-3@gated-at.bofh.it>
In reply to#269835
Richard <rrosner5@gmail.com> writes:

> python3 -m venv venv
> source venv/bin/activate
> pip install musicpy

OK thanks. And apparently to get idle working I do:

python -m idlelib.idle

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web