1

I'm working on a script that will plot data onto a map using the Basemap library. I'm trying to import Shapely as well for use in this same script. I'm working with Anaconda2 for Python2.7 in a Windows 7 environment. I used conda install to download the tar.bz2 file from the Conda Packages site (using Windows command line) and it looked like it all installed correctly.

When I open Pycharm and look at my accessible site-packages, I can see this package. However, when I try to use it within my script, I get an error saying that the package does not exist. I ran the script through the debugger to see if it would shed any more light, but I got the same error. Here's a screenshot of my available site packages when I go to Settings-->Project Interpreter from within Pycharm.

Screenshot of PyCharm site packages available

Is there something special I need to do in order to access this package from within a fresh Python file? I was trying to say "import shapely" or "import osx-64-shapely", but both give me the same "package does not exist" error message. I've been able to successfully use other third-party libraries within Python, so I'm not quite sure what the error is here....

I'm new to SO - if you need more details or there's some piece of info I didn't include, please let me know. Thank you for your help!

EDIT: I am NOT asking what the difference is between conda and pip, or how to use pip within PyCharm. I have used both successfully before to install third-party libraries. What I am asking is what might cause a third-party library that appears to have installed successfully from the command line become inaccessible from within PyCharm when I attempt to import it.

happygostacie
  • 173
  • 1
  • 11

1 Answers1

0

I'm not familiar with Shapely but I was astonished to see the name osx-64-shapely as a site-package for your python installation which is in windows 7. Are you sure you downloaded the right file? :)

Sam F
  • 499
  • 7
  • 19
  • Haha. Maybe not! I'm still a bit new to Python as well, so that could be the case. I originally tried to install shapely using the pip tool and this version from the package index: https://pypi.python.org/pypi/Shapely#downloads, but I wasn't able to get that to work either...its said the setup.py egg info was missing. I wondered if it was a dependency issue, which is why I decided to try the conda tool instead since I've heard that that takes care of those types of issues.... – happygostacie May 05 '16 at 21:33
  • well in python the typical way to install extra modules in Python is using 'pip install ', it should take care of downloading the file and un-packaging it in the appropriate location, you typically do not need to download a separate file by yourself... – Sam F May 05 '16 at 21:39
  • why is my answer being voted down? I'm just trying to help here – Sam F May 05 '16 at 21:44
  • my question was voted down too....ugh. whatever. thanks for your help though, @Sam F. I'll check out the link you suggested. – happygostacie May 05 '16 at 21:56
  • Just to answer your other question - I have some security permissions on this workstation that make me unable to access the library by using the pip install [module name]. The only way I've gotten it to work is by downloading the file directly and then uploading by stating the file path in the command line when i use the pip or conda tool. – happygostacie May 05 '16 at 21:57
  • I see. Anyways I'm pretty sure that the file you downloaded is for OSX and not for windows. Give the link I sent you a shot and If it works you can accept my answer to help me get back my reputation points :P – Sam F May 05 '16 at 22:02
  • thanks for your help! I tried it out. It looks like the specific whl file that's available on the site for Shapely wasn't compatible with my version of Windows (according to the error I got). However, I took your advice about looking for a Windows version of Shapely instead of OSX, and found this one here on the package index: https://pypi.python.org/pypi/Shapely/1.3.0#downloads. I was able to download and install the tar.gz successfully and import the library! Thank you for your help. I accepted yours as the answer since it was helpful in determining the error. Have a great day. :) – happygostacie May 05 '16 at 22:22