0

After installing Anaconda3 (python 3.9.7) on Windows 10, then opening Spyder and in the IPython console typing import h5py gives 'no such module h5py'. I noticed that sys.path did not include the site-packages directory, so I tried sys.path.append(r'C:\path\to\site-packages') but then import h5py gave

ImportError: cannot import name '_errors' from partially initialized module 'h5py' (most likely due to a circular import).

This makes me think it has something to do with the fact that Anaconda3's site-packages was not setup correctly somehow, but trying the same installer on another computer worked fine (even without any reference to anaconda in PATH).

Before any sys.path.append, sys.path reads: ['','C:\\Program Files\\Spyder\\Python\\python38.zip','C:\\Program Files\\Spyder\\Python','C:\\Program Files\\Spyder\\pkgs','C:\\Program Files\\Spyder\\pkgs\\IPython\\extensions','C:\\Users\\kaim\\.ipython']

How can I set Anaconda3 up correctly so the site-packages are seen and imported in the right order to avoid the circular import error?

Philliph
  • 31
  • 4
  • Can you include the content of `sys.path` and what your anaconda path should be? Most likely spyder is run using a different installation of python also present on your system. This can probably be fixed with a setting in spyder – FlyingTeller Aug 23 '22 at 10:20
  • I updated the OP with my `sys.path`. – Philliph Aug 23 '22 at 16:11

0 Answers0