I am running Linux Mint 18 Sarah.

I tried to run a .py file which has a pygame dependency, so I pip installed pygame into my virtual (conda) python environment. So far so good. Tested that when I enter my system python by typing python in shell, I can import pygame and create some pygame objects without errors.

But when running python my_script.py (with the pygame dependency) I got a weird error. Fatal Python error: (pygame parachute) Segmentation Fault Aborted

Someone suggested I uninstall pygame and reinstall, this is where things get really confusing to me.

When I went to uninstall, I got the message E: Unable to locate package pygame. But then when I try and pip install again, I get the message Requirement already satisfied: pygame in /home/max/anaconda3/envs/udacity_ml_nd/lib/python2.7/site-packages.

Can anyone explain why Python both can and can't find this package from the same terminal session in the same virtual (conda) environment? Please let me know if there's any further information I can provide.

  • thanks, but pip install -U pygame shows Requirement already up-to-date: pygame in /home/max/anaconda3/envs/udacity_ml_nd/lib/python2.7/site-packages – Max Power May 3 '17 at 3:29
  • 1
    thanks again. uninstalled and reinstalled but have same error. – Max Power May 3 '17 at 4:53

what ended up working for me was:

  • uninstalling with both conda uninstall and pip uninstall

    • Order seemed to matter here. I think my pip uninstall couldn't work until I first conda uninstalled, or maybe I have that backwards.
  • close terminal and re-enter my conda virtual environment (source activate my_env-name)

  • pip install pygame (NOT conda install pygame, that caused problems)

Lesson Learned

I had pygame installed with conda and pip, which was probably a pretty bad idea for any package. Presumably in the future, when something doesn't work after installing with pip or conda, Plan B should be first uninstall using that with pip or conda before reinstalling using the other one. Probably shoulda known that already...

|improve this answer|||||
  • Don't use both pip and conda. Use only conda if you have Anaconda. Use only pip if you have the "normal" CPython. – Satō Katsura May 3 '17 at 7:29
  • thanks, although in this case the script I need to run works if I pip install pygame alone but not if I conda install pygame alone, even though I have anaconda. I'm working on a udacity project and there's a forum full of people who seem to have experienced the same issue. But maybe it's because I have some dependencies which I installed before with pip instead of conda? – Max Power May 3 '17 at 7:37
  • Your problem seem to be that you have both Anaconda and (C)Python installed, and you're trying to use packages from one with the other. They don't mix well. Now, I have no idea how your distribution is supposed to handle that, if at all. But as I said, conda manages Anaconda packages, and pip manages "normal" Python packages. Installing some packages with one and some with the other won't do you any good. – Satō Katsura May 3 '17 at 7:43
  • thanks for the follow up. I'm pretty sure I never "installed" python except for the anaconda distribution, so I'm guessing the (C)Python I have installed is just my system python. I presumably should not uninstall that, right? I guess I'm still just not sure why the udacity script I need to run doesn't work properly if I conda install pygame in my conda virtualenv but does work if I pip install it in that virtualenv. But clearly my understanding of this is deficient. – Max Power May 3 '17 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.