Edit: the problem is Pycharm is not loading LD_LIBRARY_PATH
environment variable. Everything works if I add this into Pychar's environment. Why isn't it loading it?
I'm having trouble importing modules for gnuradio. First, everything works if I just run the python file from the command line, and everything loads just fine in the interpreter. There is only a problem using pycharm. Furthermore, GNU Radio is installed correctly.
PYTHONPATH=/usr/local/lib/python2.7/site-packages
I added the python interpreter, and since the module loads fine from the interpreter I'm not sure why I had to add the path to pycharm. Anyways, I added the location where the the gnuradio
module is: /usr/local/lib/python2.7/site-packages/gnuradio
; however, it was wrong. The correct path to load was the parent directory: /usr/local/lib/python2.7/site-packages
. I'm wondering why this is.
More importantly, after loading the library I get this compiler error:
File "/usr/local/lib/python2.7/site-packages/gnuradio/gr/runtime_swig.py", line 24, in swig_import_helper
_mod = imp.load_module('_runtime_swig', fp, pathname, description)
ImportError: libgnuradio-pmt-3.7.2git.so.0.0.0: cannot open shared object file: No such file or directory
The file in question is located in /usr/local/lib
, however I've added every possible path to tell it where it is but no luck. Also, I've added /usr/lib:/usr/local/lib
to my LD_LIBRARY_PATH
and ran ldconfig with no success. Only thing I could think of.
What am I doing wrong?
Again, everything works fine if I'm not using PyCharm. This is a question regarding Pycharm specifically.
Troubleshooting: Try installing/importing a package from the system terminal (outside of PyCharm) using the same interpreter/environment. In case you are using a virtualenv/conda environment as your Project Interpreter in PyCharm, it is enough to activate that environment in the system terminal and then do the test.
Python's ImportError ( ModuleNotFoundError ) indicates that you tried to import a module that Python doesn't find. It can usually be eliminated by adding a file named __init__.py to the directory and then adding this directory to $PYTHONPATH .
Navigate to the files that contain delimiter-separated values, select them, and click Open. In the Import "file_name" File dialog, specify the data conversion settings for every file. You can go through the files in the Sources pane. Click Import to import the files.
Did you tried to use virtual environments to setup interpreters on pycharm? if you need some libraries it has a package manager that lets you install libraries with a simple gui.
Let me show you a sample :
When you create a new project
Select the box on the right on interpreter
You will get a screen like this
click on the 3rd button next to the plus, minus and edit, the python logo with a "green v", then a dialog like this will appear :
click on ok and then the prior dialog will be updated like this :
Click on the install button a dialog with a repository list will appear, select the libraries you need and install on the virtual env interpreter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With