首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Python (PyCharm)和Fenics安装问题

Python (PyCharm)和Fenics安装问题
EN

Stack Overflow用户
提问于 2022-08-18 15:18:55
回答 1查看 100关注 0票数 1

我尝试安装fenics,并使用论文“混合有限元-神经网络模型:将人工神经网络与有限元方法相结合”的存储库来计算线性问题(https://github.com/sebastkm/hybrid-fem-nn-examples/tree/main/examples/pinn_linear)的线性物理信息神经网络。

我正在使用Windows 11和Python3.10.4。

要运行脚本main.py,我需要使用fenics包。和往常一样,我在python工作

代码语言:javascript
运行
复制
pip install fenics

没有任何问题。试图运行脚本会导致错误。

代码语言:javascript
运行
复制
from fenics import *
ModuleNotFoundError: No module named 'fenics'

在阅读了关于这个问题的几篇文章之后,我确保不再有其他虚拟环境,路径sys.path:

C:\Users\neuma\AppData\Local\Programs\Python\Python310\Lib\site-packages

包含包含已安装的fenics包的文件夹:

fenics_dijitso-2019.1.0 info info

fenics_ffc-2019.1.0.post0.dist-info

fenics_fiat-2019.1.0 fiat info

fenics_ufl-2019.1.0.dist-info

fenics-2019.1.0.dist-info

我注意到没有名为fenics的文件夹。

在这一尝试失败后,我尝试遵循DOLFINx (https://docs.fenicsproject.org/dolfinx/main/python/installation.html#dependencies)的指令,因为有些帖子提到了dolfinx和fenics是一样的。

安装了码头后,我按照有关在码头(https://fenics.readthedocs.io/projects/containers/en/latest/introduction.html#installing-docker)中运行fenics的说明进行操作。至少在使用终端时,这似乎是可行的:

代码语言:javascript
运行
复制
C:\Users\neuma>docker run -ti quay.io/fenicsproject/stable:latest
# FEniCS stable version image

Welcome to FEniCS/stable!

This image provides a full-featured and optimized build of the stable
release of FEniCS.

To help you get started this image contains a number of demo
programs. Explore the demos by entering the 'demo' directory, for
example:

cd ~/demo/python/documented/poisson
python3 demo_poisson.py
fenics@9548d966c2fc:~$ cd ~/demo/python/documented/poisson
fenics@9548d966c2fc:~/demo/python/documented/poisson$ python3 demo_poisson.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Solving linear variational problem.
To view figure, visit http://0.0.0.0:8000
Press Ctrl+C to stop WebAgg server

访问url提示以下消息:

代码语言:javascript
运行
复制
This page is not working
0.0.0.0 has not sent any data.
ERR_EMPTY_RESPONSE

由于我似乎尝试了所有可能的安装版本的fenics (和/或Dolfinx),但没有任何工作,我想问这里,如果有人可以帮助我安装。

我很困惑如何理解fenics和dolfinx之间的区别,以及为什么我需要Ubuntu或Linux和Docker来运行一个似乎已经安装在python中的包。也许这张截图会让它更清晰一点:

如果你需要更多的信息,请告诉我。如果有人能帮我的话就太好了。

奥斯卡

EN

回答 1

Stack Overflow用户

发布于 2022-08-24 09:18:14

如果其他人为这个或类似的问题而挣扎,解决方案在这里给出了:https://fenicsproject.discourse.group/t/installation-problems/9041/43

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73405591

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档