0

I have anaconda python 2.7 and installed the shapely package. Importing the whole package does not give errors, but then when trying to access modules that should be loaded, they dont seem to be there. Also importing the specific module throws an error.

This is the error I get when importing the module

import shapely.geometry

WindowsError: [Error 126] The specified module could not be found

Though importing the whole package seems to work

import shapely
dir(shapely)

['__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 '__version__',
 'ctypes_declarations',
 'ftools']

So the modules are not there even though shapely seems to be there.

pip has it in its list

pip list

Shapely (1.5.1)

Then when I try to install with pip anyways:

pip install shapely
Requirements already satisfied: shapely in d:\...

Trying to upgrade with pip:

pip install shapely --upgrade
Requirements already up-to-date: shapely in d:\...

Forcing reinstall with pip as per this answer did not change the errors.

Deinstalling with pip and installing it again gives a warning:

warning the c extension could not be compiled speedups are not enabled

Im not sure whats wrong here and how I can fix it, any hints to help me in the right direction would be super, thanks!

Community
  • 1
  • 1
Leo
  • 1,757
  • 3
  • 20
  • 44
  • Try `from shapely import geometry`. Looks like the dot notation for import is used for importing modules from packages - [6.12. The import statement](https://docs.python.org/2.7/reference/simple_stmts.html#the-import-statement) – wwii Dec 07 '14 at 15:45
  • Oh sorry, geometry is a module with functions in it, Ill adjust the question. Your suggestion gives this error: WindowsError: [Error 126] The specified module could not be found – Leo Dec 07 '14 at 15:50
  • 2
    http://gis.stackexchange.com/a/62931 – wwii Dec 07 '14 at 15:57
  • Very usefull answer. Not all packages are there though. But I either need a C compiler or a windows installer then? Gohlke`s website says that they are incompatible with Anaconda which I have, but will try. – Leo Dec 07 '14 at 15:59
  • It worked! Thanks. Would you also know how to do it through the C compiler, for pakcages that dont have a windows installer at Gohlkes website? – Leo Dec 07 '14 at 16:07
  • 1
    Haven't tried that yet but looked into it, there is a plethora of *free* compilers around and lots of hits with a search on how to do it. – wwii Dec 07 '14 at 16:09
  • 1
    https://docs.python.org/2/extending/windows.html#building-c-and-c-extensions-on-windows – wwii Dec 07 '14 at 16:16

1 Answers1

0

wwii `s comment solved this, using a windows installer did work. I got it from here. Probably properly installing and configuring a compiler would also work.

Leo
  • 1,757
  • 3
  • 20
  • 44