I am coding in python 2.7 using python-vtk 6.2.0 installed with the Ubuntu package manager.
I use eclipse + pydev as IDE and I can run the code successfully in shell and from within eclipse.
The only annoying problem I have is that the code analyser keeps posting errors of the type: Undefined variable from import: vtkxxxxxx whenever I do
import vtk
vtk.vtkTransformPolyDataFilter
vtk.vtkActor
vtk.vtkWhatever
I tried to reset the interpreter and I have also tried to manually add the library .so files to the PYTHONPATH, with no luck.
Also I can see the the vtk package in the project tree under system libs and I have no errors on the line import vtk
Is there a particular unusual way to include vtk library in pydev? Am I doing something stupid I do not see?
Thank you all!
I have found a similar question already asked about numpy. It has been solved so maybe you might find your answer in there. The URL for the issue is https://stackoverflow.com/a/14082269/7171962
Btw. This may be of no help to you.
I hope this helps.
had you gone through this link enter link description here
Hope this will help
Related
I am trying to create a GUI using eric6 for a Python script I coded recently, however when I right click in eric6 on the new *.ui file I create and I try to compile it (choosing 'Compile Form'), the following error is displayed - could not start puyic5.exe:
I have tried the (very few) online solutions but without any luck (for example, checking that in the pyuic5.bat file, the mentioned directory is without any space, and also tried to re-install Qt5). Furthermore, even though both Python and PyQt are correctly installed, pyuic5.exe is missing in the directory specified in the error. Also, everything seems setup ok in the PATH in the system environmental variables.
Versions info:
Python 3.4.5
Qt 5.4.1
PyQt 5.4.1
eric6 17.06
EDIT: if it can help debugging my issue, I would like to add that if I open a command prompt and I invoke pyuic5 mainform.ui -o mainform.py it works without problems. Instead, in eric6, such error message is generated.
Thank you in advance for any precious help and guidance you may offer !
Sincerely,
Paolo
Solved downgrading to an older version of eric6 (precisely to v 17.04.1). Thought it might be useful to share in case somebody encounters the same problem.
I was trying to execute a third party prolog program for my research. In the meanwhile, I discovered that it requires the pyswip package to execute, due to the program declaration
from pyswip import Prolog
So, after installing this package following the instructions in the INSTALL file, in the root folder of the pyswip installation, the package still could no be found, as with the output error:
ImportError: Could not find the SWI-Prolog library in this platform. If you are sure it is installed, please open an issue.
So after some investigation, I've discovered that the use of the package from python is called from the core.py file, in my case located at
/Library/Python/2.7/site-packages/pyswip
So analyzing this file I could locate the output error text and conclude that the path was not being found according with the specific line
elif platform == "dar": # Help with MacOS is welcome!!
So I noticed too that comment to help with MacOS. Inside the method that tries to found the path properly
(path, swiHome) = _findSwiplDar()
I noticed two array: one with two candidate names of package names and another with the path's candidates. So I've located the first package name "libswipl.dylib" doing a search on my OSX. Finishing, I've added the specific package path to the path array, and everything is working now.
I know this is not the best solution, but I've discovered how things are working and resolved the issue. If someone knows a better way to configure this kind of library without updating the core.py file, I'll be glad to know ;-)
I hope this helps someone!
Being a complete begginer in python, I decided to install the python interpreter 3.4.4, and also PyDev plugin for eclipse IDE. I am also using windows 10.
I have encountered a problem regarding certain imports, namely : from PIL import Image, ImageTk, which is apparently an unresolved import.
I have looked at certain questions which were similar to my situation, but most of them gave a solution like installing packaged from the linux apt-get. Here are some topics I visited :
Uninstalling and reinstalling Pillow and pip,
Installing pillow-imaging-tk on Ubuntu,
This topic which left me very confused,
This one seemed helpful, but is on Unix OS again
So please, could someone explain to me why I am seeing this error, and how could I correct it if I absolutely want to use Eclipse, Pydev, windows 10 and Python 3.
Found the solution, here's what I did:
Set the PYTHONPATH like it is shown in this article, make sure python.exe is accessible via cmd,
Via cmd, type pip install pillow. Alternatively, you can enter the same command from Windows+R,
(Not sure if relevant step) Via eclipse, Windows->Preferences->PyDev->PythonInterpreterremove your interpreter to re-add it,
Restart eclipse.
For Python import problems in PyDev, the project web site has a page on interpreter configuration that is a good place to start. I recently had a similar problem that I solved by adding a module to the forced builtins tab.
I'm an Ubuntu user and I've tried to make use of HTML-Graphs source code, that I need for my python script (well... it's not library but source code, I guess? If I needed anything for my scripts, I was just installing libraries through Ubuntu Softwate Center or pip command). Please, check HTML-Graphs here: http://www.gerd-tentler.de/tools/pygraphs/index.php?page=download. So my problem is: I download it as zip file... and then what? I tried to do comments like 'python graphs.py' in hope to "install it" (sorry, lack of words) but it didn't work out. What should I do to properly use the instructions from the HTML-Graphs source code? Thx!
You can copy the file graphs.py to your current project directory and then use it in your scripts with import graphs
When I write import MySQLdb in Eclipse using the PyDev plugin, I get an unresolved import. However, the program runs without error. I can add an annotation to get the error to go away, but what is the right way to handle this?
How can I help Eclipse know that MySQLdb is there?
It sounds like MySQLdb is somewhere on your sys.path, but not on your Eclipse project's PYTHONPATH; in other words, Eclipse thinks you're going to get an import error at runtime because you haven't fully configured it. Google seems to say that you can alter this setting in Window->Preferences->Preferences->PyDev->Python Interpreter to include the path to your MySQLdb module.
For some help figuring out where MySQLdb might be living on your system:
Open an interactive interpreter,
import MySQLdb
If that succeeds, you can get a hint from: print MySQLdb.__file__; it may be the __init__ file in the package that you need to point the path at.
cdleary above provided the reason two years ago, but this may be easier. Basically, one reinstalls the interpreter.
Select Window - > Preferences -> PyDev -> Interpreter - Python
Select the python interpreter in the upper pane
Click on Remove
Click on Auto Config
Agree to everything.
This works on Fedora 17 using the Eclipse 4.2.0 that came with the package management.
Fixed this by doing two things:
1) Added MySQLdb egg to the PYTHONPATH under Window->Preferences->Preferences->PyDev->Python Interpreter.
C:\Python26\Lib\site-packages\MySQL_python-1.2.3c1-py2.6-win32.egg
2) Close and re-open the .py file that had the red x.
Adding the egg works, but the error remains. The solution for that error can be found by adding
##UnresolvedImport
To the import statement, as in:
import web ##UnresolvedImport
Source: http://klaith.wordpress.com/2009/06/12/pydev-unresolved-import-errors/
I once had a similar problem on Windows (never encountered this on Linux though) and I discovered that I had to include the .egg directory of my library to my PYTHONPATH.
For example my PYTHONPATH (Pydev/Interpreter - Python/Libraries) included:
C:\Python26\Lib\site-packages
and I had to add:
C:\Python26\Lib\site-packages\jinja2-2.2.1-py2.6.egg
to use jinja.
This surely works I just tried it with Pmw package. Unzip package in site-packages. Then remove python interpreter from eclipse and then add it again. Your import errors shall go away. also you may want add module to forced builtins. See How do I fix PyDev "Undefined variable from import" errors? and http://pydev.org/manual_101_interpreter.html
I had a similar issue and the following is what I did to solve my issue. I have a Windows 8 Machine, Python 2.7 installed and running my stuff through eclipse.
Some Background:
When I did an easy install it tries to install MySQL-python 1.2.5 which failed with an error: Unable to find vcvarsall.bat. I did an easy_install of pip and tried the pip install which also failed with a similar error. They both reference vcvarsall.bat which is something to do with visual studio, since I don't have visual studio on my machine, it left me looking for a different solution, which I share below.
The Solution:
Reinstall python 2.7.8 from 2.7.8 from https://www.python.org/download this will add any missing registry settings, which is required by the next install.
Install 1.2.4 from http://pypi.python.org/pypi/MySQL-python/1.2.4
After I did both of those installs, I reopened eclipse and got a prompt to update the paths of eclipse which I accepted, after that I was able to query my MySQL db.
import MySQLdb
If this code show error like this:
Unresolved import: MySQLdb
you should add D:\Python27\Lib\site-packages\MySQLdb to your sys.path.
D:\Python27\Lib\site-packages\MySQLdb is this location where you install MySQLdb in your computer disk. After this step, the error will disappear.