Using Python OpenMDAO in an IDE (PyScripter) - python

I'm trying to use the OpenMDAO package in the PyScripter IDE, running Python2.7 on Windows 8. But trying to import openmdao I'm returned with the error "No module named openmdao". The OpenMDAO installation instructions say to (i) run the go-openmdao.py script, and (ii) enter Scripts\activate.bat. How do I do (ii) in PyScripter, or any IDE for that matter?
Thank you,
Alex

I've been able to use OpenMDAO in an IDE (Spyder) by changing the path to the Python executable in the Spyer preferences from the default system binary to the one inside of the virtualenv directory. If you can do this, the IDE will be operating within the virtualenv, and OpenMDAO should become importable. This should also work for any other python virtualenv that you would like to use within an IDE.

I have used it with PyCharm. It works very well. You can import the virtual environment created by openMDAO in the preferencies/project/interpreter/add local.
PyCharm community version is free and has a nice debugging support, so I can recommend it for beginners in python.
I never heard about PyScripter, but if there is a place where you can change the default python executable to the one in openmdao/Script, that might work.

Related

How can I add a Python version to the Python Launcher?

On Windows, how can I add a Python version to the Python Launcher? I have python 3.7 installed alongside 2.7. I've made sure that the PATH variable and the registry keys are correct. One thing I will say is that I can't see any other Python environment variables on my machine (such as PYTHONPATH), or either of the py.ini files descibed here.
If possible, I would like the solution to also work with python distribition, such as Anaconda.
This is the same question as py launcher does not find my Python 2.7, but none of the answers worked for me, so I trust I am allowed to ask again.
related:
How should I set the default Python version in Windows
I solved the problem by going to Control Panel -> Uninstall A Program, right clicking on "Python 2.7.15", clicking "change", and pressing "repair". No clue why I didn't try that first.

System Python conflict between Anaconda and existing Python installation

I've been going with a basic Python3.4 install that I've been installing many modules into for over the past month but have reached a point where pip is coming up short and I'm going to just install the full Anaconda on my system to go deeper into bokeh-server stuff.
I get a popup during the Windows 64bit installer (Anaconda3-2.3.0-Windows-x86_64.exe) saying
A version of Python 3.4 (64-bit) is already at C:\Python34\ We
recommend that if you want Anaconda registered as your system Python,
you unregister this Python first. If you really know this is what you
want, click OK, otherwise click cancel to continue.
Didn't find much documentation on this subject, and I'm not really sure how to "unregister" that installation of Python apart from uninstalling it entirely from Windows which I imagine would accomplish such a thing. Is this basically telling me to check how my Python Launcher for Windows is setup after the Anaconda installation? I'm completely unfamiliar with this notion of python system registration? Is that just a round about warning about which python version takes precedence on the system path, or which installation holds the file associations?
The solution is simply to uninstall python (for example, run the original python installer and select the uninstall option). The python key in the windows registry will be removed (which is what unregister means in this context).
Here is a link to a script that will unregister a Python installation (if you haven't come across it already). I personally have not dealt with anything like this. It seems like it should work, but you may have to tinker around with some of the paths in the script to get things to work. The links in #nightuser 's post will also probably fix the issue.
Why not just remove your version of Python? You could do a pip freeze > requirements.txt with your current Python and add them to Anaconda, or create an environment with Anaconda using those packages. Anaconda has greatly decreased the amount of time I spend setting things up.
You are getting that prompt because you have another version already installed the safe way to do this is going to the directory of the existing version and running the uninstaller. Once the previous version is completely uninstalled. You can run the installation as normal it should works!
enter image description hereYou have already installed python in your environment, so your system can handle your python code. Anaconda can handle your python code as well. If you install Anaconda and expect use python provided by Anaconda, then your system will confuse about assigning the code job. To avoid this confusion, there is always a path to point out which python you want.
You can ask your OS to find specific python by changing your environment path in windows OS:
By deleting the python path your Python will be invisible. Changing path is more convenient compared with the uninstall.
If you got a python compiling software like Pycharm, things are different. Pycharm may have python3.6 while your system got python 3.5. You need to delete path in those software or uninstall python specified by those software.
Pycharm
Actually, instead of registering the Anaconda as the system python, you can install it first, then specify your Pycharm and system path to the Anaconda python path. Thus, your Pycharm will use python provided by Anaconda and package & virtual environment you need.
I edit this for lots of times because I got Great wall, so I can't close something pop up in my screen(cause it is Blank). And everything is missing if I refresh. This is annoying.
My system path Anaconda3's python36
Add path in Pycharm
Or you can't use these packages and Anacon's virtual Environment

How should I setup the Wing IDE for use with IronPython

Here is a screen where I should point the Wing IDE to my python files. I am using IronPython.
Am I assuming correctly that textbox one gets filled with ipy.exe ? (proper path provided)
What should be in the rest of the boxes ?
I do not know about your question in particular; however few weeks ago, Michael Foord published a guide for using WingIde with IronPython.
You can find it here: http://www.voidspace.org.uk/ironpython/wing-how-to.shtml
Wing IDE at the moment doesn't allow the debug mode with IronPython. You need to link the IDE to the CPython install. (Michael Foord words in the article http://www.voidspace.org.uk/ironpython/wing-how-to.shtml]1).
Wing IDE wouldn't run the shell while pointing at Python 3.1. I am unsure whether that is something I have done wrong or that the incompabilities aren't sorted out yet.
I have installed CPython implementation from Python download site.Python download
I have set the Python executable path to the python.exe that gets installed to your Python Install directory.
I have modified the enviroment variables and added the Python directory to the PATH variable.

Is it possible to install python 3 and 2.6 on same PC?

How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.
EDIT:: im on a windows vista 64-bit
If you are on Windows, then just install another version of Python using the installer. It would be installed into another directory.
Then if you install other packages using the installer, it would ask you for which python installation to apply. If you use installation from source or easy_install, then just make sure that when you install, you are using the one of the proper version.
If you have many packages installed in your current python-3, then just make a zip backup of your current installation just in case.
Erm... yes. I just installed Python 3.0 on this computer to test it. You haven't specified your operating system, but I'm running Ubuntu 9.04 and I can explicitly specify the version of Python I want to run by typing python2.5 myscript.py or python3.0 myscript.py, depending on my needs.
Typically python is installed with a name like python2.6, so you can have more than one. There may be a symlink from python to one of the numbered files. Quite workable.
Yes, it is possible.
I maintain 3 python installations (2.5, 2.6, 3.0). The only issue that could be confusing is figuring out which Python version takes precedence in PATH variable (if any) . To execute a script for a specific version, you would go into the python directory for that version
C:\Python25\ , C:\Python26\, C:\Python30\, etc.
Drop the file in there, and run "python.exe file.py" from command-line.
You could even rename each python.exe to python25.exe python26.exe python30.exe and have each directory in PATH so it would be easy to execute any script on any version.
I would assume it'd be the same as running two versions of 2.x; as long as they're each in their own directory you should be OK.
You certainly can. On Mac Ports, there's a tool called python_select that lets you switch among python versions; if nothing like it exists on Windows (momentary googling didn't reveal one), it could certainly be written.
You can set up virtual python environments using virtualenv.

Using pydev with Eclipse on OSX

I setup PyDev with this path for the python interpreter
/System/Library/Frameworks/Python.framework/Versions/2.5/Python
since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is
variable references empty selection ${resource_loc}
Same if I use {container_loc}
Any thoughts ?
Sunit
I installed the Python.org version as well, this is a must.
I finally got PyDev working in Eclipse by pointing the interpreter to:
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
manually. If you don't do it manually (by using the Autoconfig) it seems to not find the right version.
Common practice seems to be to install an up-to-date Python 2.5 from python.org and use that instead of the system installation. I saw that recommended here and there when I got started on Mac OS X.
It installs under /Library (as opposed to /System/Library) so the system Python is intact. Pydev has /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python as its configured Python interpreter and all is well.
Can't state for sure that your trouble is due only to using the system's Python installation; in any case this way I have no trouble. Also, this way when you fiddle with your development environment (install things in site-packages, upgrade Python), anything that uses the system Python is sure to be unaffected.
I know this is a ancient post... but, in case of some newbee like me to get the better answer.
I just using "Eclipse Marketplace" from the "Help" menu and search for keyword "python" or "PyDev" to get PyDev, and get it successfully installed.
AND, you should add PyDev to the top-right dock.
For the instance, my eclipse on my laptop's OSX is (Version: Indigo Service Release 2 Build id: 20120216-1857).
Have fun, folks! :)
I believe ${resource_loc} or ${container_loc} (without any argument) are based on the current selection in your workbench when you are launching your script.
So are you selecting the right resource when selecting that script through the "external tool" runner ?
At least, click on the project name before you run one of the external programs.
Note: it works with a selection in the Navigator or Package Explorers views (the latest might not be available in PyDev environment though)

Categories

Resources