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!