Pip installation--"pip3" behaves differently to "pip"?


#1

I’ve been having trouble building a game using the build-system, and I think that the problem may lie in my Panda installation. For example, the build-system has taken to reporting that it can’t find “egg2bam”.

When dealing with the fullscreen issue recently, I found that installing with just “pip” (that is, not “pip3”) didn’t seem to get the expected commit.

As a result, I decided to uninstall Panda using “pip”; I should now have it installed only via “pip3”. (And, to be safe, I have subsequently uninstalled Panda via “pip3”, then re-installed it via the same.)

However, I’ve noticed that “pip” and “pip3” seem to behave differently.

The “pip” command insists on having root access–I imagine that, amongst other things, this allows it to install tools like “egg2bam” in such a way that they’re globally available. Indeed, after installing in this way, “egg2bam” is available.

On the other hand, if I try to install using “pip3” with root access, it tells me that the “requirement [is] already satisfied”–as though Panda3D is already installed! However, if I install without root access, it succeeds! It succeeds–but “egg2bam” isn’t available.

I fear that I’ve messed up my installation in some way. Could someone please help me to untangle it? ^^;


#2

I think you are using Ubuntu, right? Ubuntu has two versions of Python side-by-side; “python” and “pip” map to Python 2, whereas “python3” and “pip3” map to Python 3.

When you use pip to install Panda3D, your version of Panda3D is fully self-contained to the version of Python that you’re installing it into, so you can in fact install it into both Python 2 and Python 3.

An easy way to make sure that Panda is installed into the Python version you’re actually using to run things is to run it with “python -m pip” instead of just “pip”, assuming you are also running your Panda games with “python”.

I know that pip allows per-user installations, but it defaults to a system-wide installation. I think this is controlled with the --user flag. I wonder if you used a per-user installation for one of your installs?

Also, keep in mind that other ways of installing Panda3D (such as via .deb, or from source) might interfere with pip installs. It might be good to do a locate panda3d/__init__.py on your system to find out all the different installs of Panda3D you might have on your system, then figure out how to remove them all, and then start from scratch.

Finally, I’d be remiss if I didn’t point out virtualenv, which is a wonderful little tool that avoids all this mess by creating a self-contained Python environment inside a directory of choice, in which you can install any pip packages you want, which you can just delete if you want to start over. :slight_smile:


#3

I think you are using Ubuntu, right?

Correct, yes.

At the moment I’m doing everything Panda-related with Python 3–or at least, that’s what I want to have happen. For example, my build-system command is as follows:

python3 setup.py bdist_apps

I wonder if you used a per-user installation for one of your installs?

Not to the best of my knowledge. When I was using Python 2, I just prepended “sudo” to the “pip” command, so that it had root access.

It might be good to do a locate panda3d/__init__.py on your system to find out all the different installs of Panda3D you might have on your system, then figure out how to remove them all, and then start from scratch.

Hmm… After uninstalling Panda I seem to have three such entries:

Two seem to be related to my IDE (PyCharm); I’m hesitant to mess with those. (Although, given the time that it spends updating skeletons and stubs on startup, I suspect that it generates them.)

The other is the following:

/usr/local/lib/python3.6/dist-packages/panda3d/__init__.py

Looking there, I seem to have several Panda-related files and folders. Should I perhaps just delete those, or is that in some way unsafe? (And just to check: is the folder “/usr/local/lib/python3.5/dist-packages/pandac” one of Panda’s? I don’t want to delete something non-Panda-related… ^^; )


#4

Did you ever install Panda3D from source? If so, I think these are from that.

It should be safe to delete these, as long as you also delete the “direct”, “pandac” and “panda3d.dist-info” directories that go alongside it.


#5

Ah, I missed the “direct” folder–thank you for mentioning it! ^^;

And that seems to have fixed the installation issue! Installing Panda via “pip3” (using “sudo”) now not only succeeds, but seems to install “egg2bam” as expected. Thank you for your help! :slight_smile:

This does bring me back to the original problem that resulted in my discovering this one–but that’s for another thread, presently…