paraview-python: Could not import vtkCommonComputationalGeometry - python

I try to run a python script (test.py) containing this line only:
from paraview.simple import *
I want to use the last version of paraview. So, I downloaded it from the official webpage and I uncompressed the corresponding archive into a folder, say /home/paraview.
If I do not anything more than running the script with
python test.py
I get the following error message:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from paraview.simple import *
ModuleNotFoundError: No module named 'paraview'
So, I set my PYTHONPATH like this:
export PYTHONPATH=/home/paraview/lib/python2.7/site-packages:$PYTHONPATH
Then, I rerun my script and I get a different error message:
Error: Could not import vtkCommonComputationalGeometry
Segmentation fault
I tried to set LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=/home/paraview/lib
where vtkCommonComputationalGeometry.so is but it does not work.
Furthermore, if I try to locate vtkCommonComputationalGeometry, I find it in another location:
/usr/lib/x86_64-linux-gnu/libvtkCommonComputationalGeometry-6.2.so
I removed vtk with apt but it is still here.
Do you know how I could run my script?

Just use pvpython, that can be found in ParaView binaries.
path/to/ParaView/bin/pvpython test.py

try to install PVGeo package.
pip install PVGeo

Related

Python module not found when using MSIPred

I am very new to python. I am trying to use a pre-existing algorithm on my data:
https://github.com/wangc29/MSIpred
I downloaded the code from GitHub and used my command line installer as suggested on the first instruction of the vignette in the above link.
I save a python file in the same directory as the downloaded code and attempt to execute the first line:
import MSIpred as mp
I receive this error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import MSIpred as mp
ImportError: No module named MSIpred
This is my directory organization. I have tried with both MSI_Smoker and MSI_Smoker2 as seen in the image below.
Any suggestions?
Edit:
In response to some comment, I tried moving the python script into the parent folder but I get the same error.
The easiest way is to add the lib path to the environment parameter PYTHONPATH(https://www.tutorialspoint.com/What-is-PYTHONPATH-environment-variable-in-Python)
export PYTHONPATH=$PYTHONPATH:`pwd` (replace `pwd` to the lib path)
link Python error "ImportError: No module named"

Problem importing a specific library with python 2.7.10

I am trying to install the following package in my MacOS High Sierra 10.13.6:
https://github.com/Michalychforever/CLASS-PT
When i run the make file everything looks to work fine. It not only generate an executable, which i can run by terminal using the ./ command, but also a python wrapper. The problem is related only with the former.
When i try to import the library i get the following message:
import classy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/thiagomergulhao/Library/Python/2.7/lib/python/site-packages/classy.so, 2): Symbol not found: _zdotu_
Referenced from: /Users/thiagomergulhao/Library/Python/2.7/lib/python/site-packages/classy.so
Expected in: flat namespace
in /Users/thiagomergulhao/Library/Python/2.7/lib/python/site-packages/classy.so
I am using the built-in python version (i.e 2.7.10). I already installed the Xcode 10.1 together with command line commands. My .bash_profile is:
export PATH="/Users/thiagomergulhao/Library/Python/2.7/bin:$PATH"
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Does anyone have any ideia what is causing this problem?

Getting an error for a module that I definitely imported

import pyinputplus as pyip
while True:
prompt='Want to know how to keep an idiot busy for hours?\n'
response=pyip.inputYesNo(prompt)
if response=='no':
break
print('Thank you. Have a nice day.')
When I run my above code , I get this error:
Traceback (most recent call last):
File "c:\users\XXXXXX\mu_code\idiot.py", line 1, in <module>
import pyinputplus as pyip
File "c:\users\XXXXXX\mu_code\pyinputplus\__init__.py", line 15, in <module>
import pysimplevalidate as pysv # type: ignore
ModuleNotFoundError: No module named 'pysimplevalidate'
I cannot figure it out. The module is definitely installed. I've even moved it from the folder it was originally installed in to the mu folder where the py file is saved. Any help would be appreciated.
The ModuleError says that you do not have pysimplevalidate installed.
Using the same python executable as you are using to run your script (idiot.py), run
python -m pip install pysimplevalidate
or, even more bullet-proof:
<path_to_python.exe> -m pip install pysimplevalidate
If you are not sure what python executable the script is using, you can check it with
# put this on top of your script
import sys
print(sys.executable) # will print C:\path\to\python.exe

ModuleNotFoundError: No module named 'bayesnet'

I'm trying to use the OpenBayes module, but the problems start from the very first step :'(
When I try to import from OpenBayes
I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Мари\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenBayes\__init__.py", line 7, in <module>
from bayesnet import *
ModuleNotFoundError: No module named 'bayesnet'
UPD: While installing (from .exe file) for py2 i gor error: "could not set a key value" (not a python error, but in dialog window)
I tried using pip install from console, but still get errors there.
Command "python setup.py egg_info" failed with error code 1 in C:\Users\CD3B~1\AppData\Local\Temp\pip-build-m4nnwa4o\OpenBayes\
Also not sure which py (2 or 3) is used when i type a command from console(
(Sorry for all that stupis questions)
You should
from OpenBayes import *
or
from OpenBayes import BNet
Here is an example demonstrating it's usage:
https://github.com/willasaywhat/OpenBayes-Fork/blob/master/Examples/bn_asia.py
I had the same problem and I created a directory with the same name as the root folder (within the root folder). Python then referred Its import calls to the src directory and not the folder. I also changed the python interpreter to a virtual (anaconda.exe), as the python install did not contain many of the modules that were being called by the application (flask, etc)
It's a weird workaround, but it worked for me. Hope this helps

Error during library import in Python (Windows)

I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.

Categories

Resources