Python comes with IDEA or extra installation needed?

11 posts / 0 new
Last post
Bert_B
Offline
Joined: 11/04/2020 - 06:46
Python comes with IDEA or extra installation needed?

Hi,

First of all thanks for adding me to the community.

I have a general question regarding IDEA and Python:
Does IDEA come with a Python 3.5.3 installation or is it necessary to have Python installed extra to be able to use it?

When I try to run a Python script from IDEA it says Windows does not know how to open the .py (Python) file. Reason is as far as I understand that Python is not installed and no compiler could be found.

I was confused, because in the manual it says that IDEA comes with Python-Interpreter, certain Python packages and files for Python 3.5.3. So I thought I am wrong and it is possible to use Python scripts with IDEA without having Python extra installed?

Thanks for the clarification.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
Hi Bert_B

Welcome to the site, hope you enjoy it.

Depends which version of IDEA you are running. I believe 10.4 added Python. To be able to run python scripts you have to run them either from the ribbon or from an IDEAScript. If you want to run them from outside IDEA then you need an IDEA installation. I created a video that should help you out on using IDEA - https://www.youtube.com/watch?v=wNXWIX6LBq8&t=460s check it out and let me know if you have any questions.

Brian
klmi
Offline
Joined: 02/13/2019 - 08:41

To run a python script from outside IDEA have a look on the following thread:

https://www.ideascripting.com/forum/pythonwin-ide-and-gui-framework

It's possible to link python scripts with that app. But if you need python modules which are not delivered with IDEA you will need a separate python installation.

Bert_B
Offline
Joined: 11/04/2020 - 06:46

First of all thanks for the fast answers!

I am using Client Version: 10.4.1

I checked your youtube video and did it in the same way and I do get the messagebox. So it works. Thanks for this!

One problem: As in your video, in fact two pop-up windows open: One is the actual messagebox where I can click on ok and the other is a window with "tk" in the title head (I know it comes from python tkinter), but showing nothing. In your video it disappears after you clicked on ok. However, in my case it stays. It does not disappear. When I click on the "x" to close it, whole IDEA is closed. What is the problem here? How can I close the "tk" window box?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
That is actually a python question, if you do a google search there are lots of posts on how to do this. Here is one I found. https://stackoverflow.com/questions/110923/how-do-i-close-a-tkinter-window
Bert_B
Offline
Joined: 11/04/2020 - 06:46

Once again thanks for your help.

One further question:
Is it possible to add additional packages to the IDEA Python with manually downloading the Python PIP packages and somehow adding them to the IDEA Python? In the help it says if Python 3.5.3 is installed and additional packages are installed via the pip installer then it is possible to use them from IDEA. However, I do not have Python installed (and I can't do this). So I conclude it is not possible and limited to the packages mentioned in the help. Or is there any way to manually download the pip Python packages and adding them to IDEA wihtout having an extra installation of Python?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
Hi Bert_B

One thing that you can do, if you need any additional packages, is to manually download the package and install it in the directory that your script is in, that way it will have access to that module. CaseWare is looking at this problem and it should be fixed in the next version of IDEA.
Bert_B
Offline
Joined: 11/04/2020 - 06:46

Thanks for the fast answer. "Install it in the directory": When I download a Python package, I get a tar.gz file. Does "install" mean to unzip / extract it into the directory? I do not have Python installed or any other Python packages managing software.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
A tar.gz file is just a type of zip file. I think Winzip can open the file 7-zip also should handle this type. So just unzip the file and place the contents in the same folder as your python script and that should allow you access to it in your project.
Bert_B
Offline
Joined: 11/04/2020 - 06:46

When I tried it I ran into the problem that the package requires other packages. Furthermore it requires Python 3.6+ and numpy and pandas in a newer version as stated in the IDEA help. Is there any way to update the packages like numpy and pands to the current version? Any possibility to update the IDEA 3.5.2 Python to something like Python 3.7? Furthermore I stored the packages which are required for the package I want in the folder too, but still I got an error. So the dependies of the packages are quite various it seems.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
Hi Bert,

Unfortunately you will have to wait until the next version of IDEA for these options. You can create a python environment outside of IDEA that you can use, the downside to that it you won't be able to run your script through the IDEA ribbon or through an IDEAScript unless you package it as an exe file with all the needed items. I created a video that will help you create an environment outside of IDEA. In the video I am using the same items as contained in IDEA so that you can run the script from IDEA but in your case you would update for the features that you need. https://www.youtube.com/watch?v=wNXWIX6LBq8&t=461s