Comments (9)
It sounds like you have multiple versions of Python on your computer. Spyder uses one and you have installed Nutils in the other. Did you install Nutils in a terminal using pip install nutils
? If so, can you verify that you can run the Cahn-Hilliard script in a terminal using python3 cahnhilliard.py
or python cahnhilliard.py
?
from nutils.
Hey Joost,
Thank you for the reply. I have deleted all Anaconda from my PC and uninstalled Spyder (all of it) and redid everything. Even reinstalled nutils again. I did download nutils in a terminal using pip install (I followed all the steps). When I tried to verify the cahn-hillard script in the termal of anaconda prompt that didn't work (not sure if you meant anaconda only?). I also put it in the terminal for Spyder and it gave me this:
python Cahn-Hilliard.py
File "C:\Users\Shant\AppData\Local\Temp\ipykernel_19008\1985523429.py", line 1
python Cahn-Hilliard.py
^
SyntaxError: invalid syntax
Unfortunately I still get the same error when I run the Cahn-Hillard file as well:
runfile('C:/Users/Shant/nutils/nutils/Cahn-Hillard.py', wdir='C:/Users/Shant/nutils/nutils')
Traceback (most recent call last):
File "C:\Users\Shant\nutils\nutils\Cahn-Hillard.py", line 80, in
from nutils.SI import Length, Time, Density, Tension, Energy, Pressure, Velocity, parse
ModuleNotFoundError: No module named 'nutils.SI'
So this is really strange and I can't seem to find the issue...
I can find the nutils files when I look into it manually, but Spyder can't seem to detect it....
from nutils.
When I tried to verify the cahn-hillard script in the termal of anaconda prompt that didn't work (not sure if you meant anaconda only?)
Did you write pip install
in an anaconda prompt? I don't know anaconda, so I'm not entirely sure what an anaconda prompt is. If this is an interactive Python session instead of a shell (bash, dash, powershell, etc.), then running python Cahn-Hilliard.py
won't work. This is also the reason why the following didn't work.
I also put it in the terminal for Spyder and it gave me this:
python Cahn-Hilliard.py File "C:\Users\Shant\AppData\Local\Temp\ipykernel_19008\1985523429.py", line 1 python Cahn-Hilliard.py ^ SyntaxError: invalid syntax
However, it turns out that you managed to run the Cahn-Hilliard example up to the point where it complains about the absence of some other dependency: nutils.SI
:
Unfortunately I still get the same error when I run the Cahn-Hillard file as well:
runfile('C:/Users/Shant/nutils/nutils/Cahn-Hillard.py', wdir='C:/Users/Shant/nutils/nutils') Traceback (most recent call last): File "C:\Users\Shant\nutils\nutils\Cahn-Hillard.py", line 80, in from nutils.SI import Length, Time, Density, Tension, Energy, Pressure, Velocity, parse ModuleNotFoundError: No module named 'nutils.SI'
Can you run
pip install https://github.com/evalf/nutils-SI/archive/refs/heads/master.zip
just like you ran pip install nutils
and try the example again? Otherwise you can try any of the other examples, as they don't depend on nutils.SI
.
from nutils.
I didn't mean to close this as completed (im new to github).
Yes I followed all the steps that was told when downloading nutils through anaconda prompt (pip install etc etc).
I ran the "pip install https://github.com/evalf/nutils-SI/archive/refs/heads/master.zip", and it worked nicely:
(base) C:\Users\Shant>pip install https://github.com/evalf/nutils-SI/archive/refs/heads/master.zip
Collecting https://github.com/evalf/nutils-SI/archive/refs/heads/master.zip
Downloading https://github.com/evalf/nutils-SI/archive/refs/heads/master.zip
- 12.7 kB 706.2 kB/s 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: nutils.SI
Building wheel for nutils.SI (pyproject.toml) ... done
Created wheel for nutils.SI: filename=nutils_si-0.1-py2.py3-none-any.whl size=8278 sha256=478ea9090a50b1cefbd93f428407d9abe27f09032431c689d7f556f5c07521f7
Stored in directory: C:\Users\Shant\AppData\Local\Temp\pip-ephem-wheel-cache-_5g8ptqj\wheels\39\15\80\b5a6031e522361753c4cda9fcde7856eb2a42dacb08edb55e0
Successfully built nutils.SI
Installing collected packages: nutils.SI
Successfully installed nutils.SI-0.1
However when I run the file again on spyder I get:
runfile('C:/Users/Shant/nutils/nutils/Cahn-Hillard.py', wdir='C:/Users/Shant/nutils/nutils')
Traceback (most recent call last):
File "C:\Users\Shant\nutils\nutils\Cahn-Hillard.py", line 80, in
from nutils.SI import Length, Time, Density, Tension, Energy, Pressure, Velocity, parse
ModuleNotFoundError: No module named 'nutils.SI'
So for some reason my Spyder cannot recognize it... Im not sure why.
Yes you are right about testing other examples as well, but I have a project on Cahn-Hillard equation and to study it, which is why I am very dedicated on solving this problem. Thank you so far for the help though, but I'm not sure what the best thing to do is..
from nutils.
Can you run the following in Spyder in a (Python) console and copy the output here?
import sys, os
print('sys.path', sys.path)
print('cwd', os.getcwd())
import nutils
print('nutils', nutils.__file__)
import nutils.SI
print('nutils.SI', nutils.SI.__file__)
from nutils.
import sys, os
print('sys.path', sys.path)
print('cwd', os.getcwd())
import nutils
print('nutils', nutils.file)
import nutils.SI
print('nutils.SI', nutils.SI.file)
gave me:
sys.path ['C:\Users\Shant\anaconda3\python39.zip', 'C:\Users\Shant\anaconda3\DLLs', 'C:\Users\Shant\anaconda3\lib', 'C:\Users\Shant\anaconda3', '', 'C:\Users\Shant\AppData\Roaming\Python\Python39\site-packages', 'C:\Users\Shant\anaconda3\lib\site-packages', 'C:\Users\Shant\anaconda3\lib\site-packages\win32', 'C:\Users\Shant\anaconda3\lib\site-packages\win32\lib', 'C:\Users\Shant\anaconda3\lib\site-packages\Pythonwin', 'C:\Users\Shant\anaconda3\lib\site-packages\IPython\extensions', 'C:\Users\Shant\.ipython']
cwd C:\Users\Shant\nutils\nutils
nutils C:\Users\Shant\AppData\Roaming\Python\Python39\site-packages\nutils_init_.py
nutils.SI C:\Users\Shant\AppData\Roaming\Python\Python39\site-packages\nutils\SI.py
I think I did something. I decided maybe it's best to drag the nutils.SI file into the folder manually and now when I run, I dont get that error anymore:
Is this what I am supposed to get and if so, where can I see the simulations?
from nutils.
I think I did something. I decided maybe it's best to drag the nutils.SI file into the folder manually and now when I run, I dont get that error anymore:
If this works for you, let's keep it like this.
I'm a bit worried by the image you've pasted. It looks like you've copied the example into a copy of the Nutils source tree. That's potentially error-prone as Python can import packages from the current working directory (see the output of sys.path
and os.getcwd()
above). It's best to keep your scripts (e.g. the Cahn-Hilliard example) in a separate directory. If you've installed Nutils using pip
there's no reason to have an additional copy of the source somewhere on the disk.
Is this what I am supposed to get ...
I'm afraid this is what it looks like in Spyder. In a modern Windows Terminal it should look better.
... and if so, where can I see the simulations?
At the end of the simulation the location of the HTML log is printed in the console (example console output). You can open the link with a browser.
from nutils.
Okay it seems like the simulation was a success.
Thank you a million, joost :)
from nutils.
Great! I'm closing this issue now. If you encounter a different problem, please open another issue on GitHub or discuss this in our public Matrix chat room (preview).
from nutils.
Related Issues (20)
- Error in running the examples HOT 3
- drop `__slots__` from `Evaluable` HOT 1
- replace `CacheMeta` with `cached_property` or `immutable_cached_property` HOT 1
- merge common functionality of `LoopSum` and `LoopConcatenateCombined`
- make `Evaluable` array-only
- remove `apply_annotations` from the `evaluable` module
- update external github actions
- early and informative exception when passing a non-scalar func to `solver.optimize` HOT 4
- Bug(?) with topology tags HOT 1
- derivatives and substitutions with values bound to one or more spaces HOT 2
- Basis creation fails on punctured multipatch topologies HOT 3
- Simplices for element references
- prevent division by zero in log message
- Reading VTK exports with meshio HOT 1
- incorrect weights in zipped sample
- support calling in cli.run
- allow nested integrals over the same space
- replace cast_withscale with numpy-style dispatch for SI HOT 1
- MKL 2024.0.0 Pardiso fails on Windows HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nutils.