Menu

Unresolved Import matplotlib

johncroc
2013-04-04
2013-04-08
  • johncroc

    johncroc - 2013-04-04

    I am a newbie to the linux world. I have installed pydev, matplotlib, and eclipse on ubuntu (from the Ubuntu Software Center). I imported a project I developed under windows and am getting Unresolved Import (red squiggly underline warnings) on my "import matplotlib" lines. I have researched the problem as best I can and have determined that it is likely my pydev installation doesn't see the matplotlib install because the python path is different for one or the other.

    What I have NOT been able to find is instructions as to how to resolve the discrepency. Can anyone give me a nudge in the right direction? Actually, instead of a nudge, explicit instructions would be super helpful. :-)

    Thanks.

    John

     
    • SkipS

      SkipS - 2013-04-05

      John,

      I am a Python/linux newbie too. But I have some experience in installing Python and Eclipse/pydev on both Mac OSX systems and on Ubuntu. On Ubuntu, I installed Enthought Python (2.7). It installs into my user area so I not bothered with administrative restrictions. And it the installation bypasses the standard Ubuntu python installation. On my system, matplotlib appears in ./lib/site-packages. If you are not able to execute import matplotlib, you must not have a path to the installation library folder in your Eclipse System PYTHONPATH (Window/Preferences/Interpreter-Python Libraries tab). You need to find the matplotlib folder (presumably in your Ubuntu Python installation -- but maybe not). Then see if the folder in which it is placed appears in your System PYTHONPATH. If not, add it. I have no problem importing matplot lib either within the Eclipse environment, in the interactive Python console, or the iPython console. I looked at the Ubuntu python installation library (/usr/lib/python2.7) and it appears that all the packages go into the directory ./dist-packages. The Python executable is in /usr/bin. So one thing you could try (if you can find the matplotlib folder is to copy it into the folder /usr/lib/python2.7/dist-util.

      In the last couple of months, I have taken a crash course in using the Apple and Ubuntu Terminal program. You will need to do the same. I am not sure that you will be able to copy the mapplotlib folder into the /usr/lib area using Ubuntu version of Explorer. You will need to do that from the Terminal using the 'cp' command. You will probably need to preface cp with the 'sudo' command (e.g., sudo cp) because you are trying to do something to the administrative area of you Ubuntu installation.

      Hope this is somewhat helpful. Perhaps it is the blind leading the blind.

      Skip

      D.D. "Skip" Snyder
      Snyder Geoscience, Inc
      671 Crescent Ct
      Grand Junction, CO 81505
      (970) 254-0330
      (970) 261-5825 (cell)
      skips@bresnan.net

      On Apr 4, 2013, at 1:02 PM, johncroc johncroc@users.sf.net wrote:

      I am a newbie to the linux world. I have installed pydev, matplotlib, and eclipse on ubuntu (from the Ubuntu Software Center). I imported a project I developed under windows and am getting Unresolved Import (red squiggly underline warnings) on my "import matplotlib" lines. I have researched the problem as best I can and have determined that it is likely my pydev installation doesn't see the matplotlib install because the python path is different for one or the other.

      What I have NOT been able to find is instructions as to how to resolve the discrepency. Can anyone give me a nudge in the right direction? Actually, instead of a nudge, explicit instructions would be super helpful. :-)

      Thanks.

      John

      Unresolved Import matplotlib

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/pydev/discussion/293649/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
      • johncroc

        johncroc - 2013-04-08

        Awesome! That was exactly what I needed to know. Your help enabled me to get everything working and I am now developing under Ubuntu.

        Many, many thanks.