cannot import name '_errors' from 'h5py'

1,474 views
Skip to first unread message

Joris Strassburg

unread,
Mar 15, 2021, 12:11:24 PM3/15/21
to Cantera Users' Group

Hi

Im trying to import cantera from Spyder. When i do so, the following error Message shows up: cannot import name '_errors' from 'h5py'

I installed cantera via anaconda. Then i added the path of cantera to spyder via  sys.path.append

On my old computer i am able to import cantera like i described. I dont know why it doesent run on my new one...

print(sys.version)
print(sys.executable)
print(sys.path):

3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
C:\Users\jo_st\AppData\Local\Programs\Spyder\Python\python.exe
['', 'C:\\Users\\jo_st\\AppData\\Local\\Programs\\Spyder\\Python\\python37.zip', 'C:\\Users\\jo_st\\AppData\\Local\\Programs\\Spyder\\Python', 'C:\\Users\\jo_st\\AppData\\Local\\Programs\\Spyder\\pkgs', 'C:\\Users\\jo_st\\AppData\\Local\\Programs\\Spyder\\pkgs\\IPython\\extensions', 'C:\\Users\\jo_st\\.ipython', 'C:\\Users\\jo_st\\anaconda3\\envs\\spam\\Lib\\site-packages']


Thanks for ure support
Joris

Bryan Weber

unread,
Mar 15, 2021, 5:23:12 PM3/15/21
to Cantera Users' Group
Hi,

I'm not sure what's causing the error. Do you get the same output for the same 3 commands on a working installation?

One option might be to install Spyder into the same Anaconda environment as Cantera is installed in, then to activate that environment before launching Spyder from the command prompt with the environment activated.

Best,
Bryan

Ingmar Schoegl

unread,
Mar 15, 2021, 8:30:40 PM3/15/21
to Cantera Users' Group
Hi Joris,

Could you post the entire error stack you're getting (i.e. what comes before "cannot import name '_errors' from 'h5py'")?

Cantera 2.5.1 now has an optional dependency on 'h5py', where there may be a version mismatch. To check on that, could you run
>>> import h5py
>>> h5py.__version__

and post whether it's installed and what version it uses?

-ingmar-

Joris Strassburg

unread,
Mar 16, 2021, 9:23:10 AM3/16/21
to Cantera Users' Group
Hi Ingmar

Thanks for your fast answer. In the attachment are the two error messages, the first one showing the one that shows up when i try to import cantera and the second one when i try to import h5py. Actually they both show the same error

Thanks and greetings
Joris
error_message_2.PNG
error_message.PNG

Ingmar Schoegl

unread,
Mar 16, 2021, 11:49:30 AM3/16/21
to Cantera Users' Group
Hi Joris,

Thanks for the response - as suspected, the error appears to be due to an installation problem with h5py that is not connected to cantera. (see a couple of issues on their github page: https://github.com/h5py/h5py/issues?q=is%3Aissue+ImportError%3A+cannot+import+name+_errors)

You mentioned that you are using anaconda: did you install h5py during that process? (otherwise, it may just come 'installed' broken already)

-ingmar-

--
You received this message because you are subscribed to a topic in the Google Groups "Cantera Users' Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cantera-users/OxOSOqWqIxU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/25189584-c056-468b-8bd7-9e56efd74e9an%40googlegroups.com.

Joris Strassburg

unread,
Mar 16, 2021, 12:44:47 PM3/16/21
to Cantera Users' Group
Hi Ingmar

Yes, i used anaconda to install h5py. I reinstalled anaconda, but it didn’t solve the problem. In the github forum they mention that the error was caused through a corrupt installation. I wonder what went wrong during my anaconda installation...

Greetings

Joris

Ingmar Schoegl

unread,
Mar 16, 2021, 12:51:01 PM3/16/21
to Cantera Users' Group
Hi Joris,
Unless you need HDF support, I'd suggest to just not install h5py in your conda environment. As the issue is upstream of cantera, I'm not sure how to fix the root cause.
-ingmar-

Joris Strassburg

unread,
Mar 16, 2021, 1:18:12 PM3/16/21
to Cantera Users' Group

Hi Ingmar

I solved the problem: Before i installed anaconda i was using spyder as a standalone. I didn’t know, that it was already coming along with anaconda. I deinstalled the stand alone and used spyder via anaconda. Actually i did such as bryan recommended in his first reply to my question.

 So thanks ingmar and byian for your support!

 Greetings

Joris

Reply all
Reply to author
Forward
0 new messages