0

我无法解决以下问题:对于我的研究,我想使用Google Colab笔记本来执行我的数据分析。为此,我需要一个包(cantera),它只能使用conda安装。我能够做到这一点,但是每次我启动 colab 笔记本时,我都需要重新安装所有软件包,这需要很长时间。由于我想避免这种情况,我遵循了此链接中描述的程序:https ://dvij-kalaria.medium.com/how-to-make-load-save-a-conda-environment-in-google-colab-jupyter -322801aad486

目标是:

  1. 一次创建一个包含所有所需包的环境。[create_environment.ipynb]
  2. 将这些包以 .zip 格式导出到我的谷歌驱动器。
  3. 在新的 colab 笔记本中提取包含包的 .zip 文件。[主文件]
  4. 使用所需的包运行笔记本。

执行这些步骤时,将显示错误:

CanteraError                              Traceback (most recent call last)
<ipython-input-5-9ed24c0ae5c4> in <module>()
      1 import cantera as ct
----> 2 gas = ct.Solution('gri30.cti')
      3 
      4 # Set reactants state
      5 gas.TPX = 298, 101325, 'CH4:1, O2:2'

interfaces/cython/cantera/base.pyx in cantera._cantera._SolutionBase.__cinit__()

interfaces/cython/cantera/base.pyx in cantera._cantera._SolutionBase._init_cti_xml()

CanteraError: 
***********************************************************************
CanteraError thrown by call_ctml_writer:
Error converting input file "/usr/local/lib/python3.7/site-packages/cantera/data/gri30.cti" to CTML.
Python command was: '/usr/bin/python3'
The exit code was: 1
-------------- start of converter log --------------
sys.path: ['', '/env/python', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ModuleNotFoundError: No module named 'cantera'
--------------- end of converter log ---------------
***********************************************************************

如果我运行包含以下内容的代码单元:

!pip show cantera

我得到以下输出:

Version: 2.5.1
Summary: The Cantera Python Interface
Home-page: https://cantera.org
Author: Raymond Speth
Author-email: speth@mit.edu
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires: 
Required-by: 

表示找到了cantera包。

复制问题的文件 (.ipynb) 在我的 Github 页面上找到:files.zip

我真的希望有人可以帮助我解决这个问题!

4

0 回答 0