Raspberry Pi/Python:Uninstalling phantom Packages

Thread Starter

ErnieM

Joined Apr 24, 2011
8,415
I now have two phantom packages on my rPi. I say phantom as I cannot access them from Thonny Python apps. "pip list" in my managed environment shell does not show them, but they do appear in the system shell pip list.

I have attempted to "sudo apt remove" them, but they come back as "Unable to locate package"

Funny, they still appear in the pip listing.

Anyone have any guidance on this? If not, I'll just reinstall the OS. TIA
 

Ya’akov

Joined Jan 27, 2019
10,226
I‘m not certain about PIP’s behavior and IU am unsure if it actually interacts with the OS package manager or not.

But, if it does then:

The symptoms suggests that the installed package list for the system level is desynced from the apt list. Since apt does not believe the packages are installed, the first thing I would do is use apt to install one of them, the perform apt-get purge <package>.

Whatever mechanism is supposed to keep PIP in sync with apt should be invoked, and pip list should the not show the stuck package. It is possible that both could be gone if PIP does some sort of list rebuild at startup triggered by a change made in apt.

Or… this may do nothing. But it is easy to try.
 

Thread Starter

ErnieM

Joined Apr 24, 2011
8,415
Thanks Ya’akov, I tried that with no luck.

As this is really the first project I'm working on with this particular rPi, I don't have much work on the system itself. So I just reimaged the SSD memory with the OS and will try this again.
 

Thread Starter

ErnieM

Joined Apr 24, 2011
8,415
SOLVED!

After reinstalling the OS, fresh build, I went about installing my packages using the facilities built in to Thonny. All went well till I got to gpiozero. I loaded it using the Thonny command line window, reported success, but again did not show in my managed environment. It was installed on my system, and could load it when not using Thonny.

After trying many many things I went basic. Opened a terminal (NOT from Thonny), and directed it to my managed environment. Then installed gpiozero that way. And it was placed correctly into my managed environment!

There were a few issues running Thonny unmanaged (basically start it from a command prompt) where pieces of packages would not load. Restarting Thonny normally (using my environment) gave me complete success, even showing gpiozero in the Thonny command prompt.

When I get back on my rPi I will list the commands I used for this.
 
Top