Eclipse wont import my enthought modules - python

I have installed eclipse installed along with enthought. I can import my standard python modules no problem, but as soon as try to import my enthought modules I get an import error. I cant find the folder/location as to where the enthought modules are, so I can add that folder directly to eclipse.
Can someone point me as to where enthought installs the modules so I can add it to eclipses python path?
EDIT:
I'm on Mac OS X 10.7.2
Using Python 2.7

First, you need to install pydev, the Python plugin for Eclipse.
Because only with that the PYTHONPATH becomes manageable.
Then you need to go to Settings->Pydev->Python Interpreter and pick the python interpreter you are using (and that uses the correct path to find all the other EPD modules).
So, if for example you are using the newest Enthought 7.2, then your Python interpreter for that would be in:
/Library/Frameworks/Python.framework/Versions/7.2/bin
In there you pick the python executable, and the Pydev plugin will then analyze all paths so that they will be known, even including automatic completions.

Related

How do I reset the python build system in Sublime Text 3 on WIndows 10?

I've deinstalled and reinstalled a bunch of Python Versions and edited my system variables in order to clean up the quagmire of pip not being able to install packages to the right locations. Long story short: Sublime now can't find numpy (or any 3rd party module), because it somehow figured that the python 2.3 version that comes with ChemDraw is the one I really want to use, not the 3.9 version I had used previously.
I've tried a bunch of tutorials online (such as resetting everything to factory settings) however nothing seems to unlink the python build system from that python 2.3 version that came with ChemDraw. Even deinstalling everything and installing Sublime 4 keeps that association. Like...how?
So here's my problem: My build system for python is linked to the wrong python version and I don't know how to link it to the python 3.9 that's located in AppData/Programs.
How can I associate the python.exe of python 3.9 in AppData with my python Build System instead of the current python 2.3, which is located ProgramFiles?
Ok, so the problem was that there was a system variable called PYTHONPATH, which I don't remember setting. It seems that Chemdraw, if installed with ChemScript, installs it's own python installation, which is 2.X.
That python install seems to set its own system variable called PYTHONPATH, which Sublime seems to prioritize for it's default python build system.
Delete whatever incorrect path is set in PYTHONPATH and paste the following into it instead:
C:...\Python\Python39\Scripts;C:...\Python\Python39;C:...\Python\Launcher;

Intellij Idea: Python import showing error even when code using module is running

I am working on a python project using editor Intellij Idea, Ultimate 2017 Edition.
In my working file sample.py code looks like
import os
def sample_fuc():
print(os.stat("C:\\Users\admin"))
Python SDK is already configured, code is running fine [When running through intellij run configuration] and printing the desired result, but somehow Intellij is not able to find the module os and showing error No module named os
So, I want to understand 2 things here :
1.) How does Intellij idea searches for modules available in python libraries. Do I need to configure somewhere in intellij to look for available modules. Is there something default set to it, if yes, why common module like os is not available in default path?
2.) If I need to configure, what all directory paths python usually have on windows where it stores installed modules?
possible intellij is not able to identify your python interpreter path.
refer: How do I get IntelliJ to recognize common Python modules?

Python interpreter, virtual environments and pycharm

Platform Windows. IDE PyCharm CE.
I have a script that uses module ArcPy from ESRI. This module has its own Python 2.6. I have to import a module that uses dictionary comprehensions not supported by Python 2.6.
How do I work around this without rewriting the code to avoiding list comprehensions?
Other questions:
What should be the correct pattern for project creation and interpreter maintenance? Should I always use virtual dedicated envs for each project importing any needed modules and keep isolation for each?
Is it correct to import the extra needed packages for my projects to the ArcPy python installation Python 2.6.5 (C:/Python26/ArcGIS10.0/python.exe)? Can this cause problems later to arc map?
You can upgrade your ArcGis Python 2.6 release to 2.7.
If you need Python 3, it won't work, because arcpy works only in Python 2.

keeping libraries at correct place when multiple pythons are installed

QUESTION1:I have 3 versions of pythons installed in my mac.
1.Apple supplied one (2.7.1) (/usr/local/bin)
2.Macports installed one (2.7.3) (/opt/local/bin)
3.and one from python.org (2.7.3) (/Library/Frameworks/Python.framework/Versions/2.7/bin)
I would like to add external modules like opencv,pygame.I have no idea where the installed binaries are going and when I try to import them I get this "no module found" error.How to make macports installed python and python.org installed python use opencv module or some other external modules.
QUESTION2:How to add external libraries to pydev in eclipse
When you configure your interpreter in eclipe (either the first time, or by going to the preferences menu) you need to select an interpreter (don't use the auto-configuration).
Eclipe will use that interpreter, and libraries relative to it. If you install new libraries, just go back to prefrences>pydev>interpreter, and click "Apply" on the screen where the interpreters are selected (you don't need to change anything, but new libraries will be scanned for).
I recomend using ports, if possible, since you'll most likely find everything you need there and won't have to deal with any manual installation of modules.

pydev issue with gobject

It seems that Pydev (1.5.4) on Eclipse (3.5.1) with Python 2.6 isn't able to correctly cross-reference the package gobject. Putting import gobject works OK but any more than that (e.g. class X(gobject.GObject) causes Pydev to report "unresolved reference" errors.
What could be the problem?
Note that every other package I use doesn't trigger this error.
The issue is related to this limitation of PyDev:
I have a library installed and Pydev
does not find it
Well, problems have been reported on
Mac and Linux, and the main reason
seems to be symlinks. Pydev will only
find extensions that are 'really'
below the python install directory.
This happens because the 'less common
denominator', which in this case is
windows, does not have symlinks. A
workaround to this problem includes
manually adding the given folder
installation to the pythonpath or
changing the installation of the
package to be under the site-packages
folder.
To adjust for this limitation, find the absolute path to the library and update the libraries associated with the interpreter for Pydev.

Categories

Resources