Request for help to get pynastran working

25 views
Skip to first unread message

Andrea Carpi

unread,
Aug 25, 2024, 3:25:23 PM8/25/24
to pyNastran Discuss
I've been working to set up the `pyNastran` library in a Python environment for a project I'm running in PyCharm. 

Here's a summary of what I've done:

1. Python Environment Setup:
   - Created a virtual environment in my PyCharm project directory.
   - Installed `pyNastran` (version 1.4.1) along with its dependencies using `pip`.

2. Issue Encountered:
   - Despite the installation being successful (`pip show pynastran` confirms the package is installed), I initially faced a `ModuleNotFoundError` when trying to import `pyNastran` in my script.

3. Steps Taken to Troubleshoot:
   - Verified that PyCharm is using the correct Python interpreter by checking the interpreter settings in the project configuration.
   - Activated the virtual environment manually via terminal and ensured that PyCharm's run/debug configuration uses the right interpreter.
   - Reinstalled `pyNastran` to ensure there were no installation issues.

4. Testing Code Snippet:
   - Successfully ran a simple PyQt5 and VTK test, and also a basic BDF model creation using `pyNastran`.
   - However, I'm now facing issues with reading OP2 files using the following code snippet:

   python code:

   import os
   from pynastran.op2.op2 import OP2

   op2_file = 'hm14_test.op2'
   op2 = OP2()
   op2.read_op2(op2_file)

   print(op2.get_op2_stats())
   ```

 I'm not sure if the problem lies in the code or configuration.

Request for help
If anyone has experience with `pyNastran` or similar issues in PyCharm, I would appreciate any guidance on what might be going wrong or how to further troubleshoot this. Any tips or suggestions would be incredibly helpful!

Steven Doyle

unread,
Aug 25, 2024, 3:33:42 PM8/25/24
to pynastra...@googlegroups.com
I’m not sure what error you got, but it sounds like you have two errors. If there is a ModuleNotFoundError, the full error message would help to debug It.

In regards to your script, the package is pyNastran and not pynastran.

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynastran-discuss/2b36086a-4f7e-407f-8412-d7b3f5d9fa3bn%40googlegroups.com.

Andrea Carpi

unread,
Aug 26, 2024, 9:19:29 AM8/26/24
to pyNastran Discuss
Thank you! 

I figured the capital letter of the "N" corrected the error and it now works with pyNastran.

Regards

Reply all
Reply to author
Forward
0 new messages