user3017048
user3017048

Reputation: 2911

Python module loading everywhere but not in PyCharm

I want to use the rasterio package for some Python script. I use Anaconda an I have set up an own environment in which I'm working.

The problem is that rasterio imports fine everywhere but not in PyCharm. When I use the Anaconda command prompt, activate my environment, run Python and type import rasterio it works. Also when I open a jupyter notebook, an import works. However, when I try to import it in PyCharm, the following error occurs:

Traceback (most recent call last):
File "C:\Anaconda\envs\oggm\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-7a1458fddb27>", line 38, in <module>
import rasterio
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.3\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Anaconda\envs\oggm\lib\site-packages\rasterio\__init__.py", line 8, in <module>
from rasterio._base import eval_window, window_shape, window_index
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.3\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)

Upvotes: 2

Views: 607

Answers (1)

user3017048
user3017048

Reputation: 2911

Okay, the simple solution is to update the gdal package and then rasterio imports fine also in PyCharm... I don't know why it worked for all other attempts.

Upvotes: 2

Related Questions