Python Forum
Pycharm project desktop deployment - advices?
Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pycharm project desktop deployment - advices?
#1
Hello,
I am Pycharm user (commercial version) since September. I have made a Pycharm project involving several .py files doing some invisible logic (scientific calculations etc..) under the main.py which defines a simple GUI (TKinter at the moment but to me it is not a must to use this module, it could be anything) which has a single button and invokes the forementioned calculations and prints in console output. It works the way I wish in Pycharm "run" mode. No DB involved. Python version 3.4.0.
Now the problem is that until a few days ago I didn't realize that Pycharm cant deploy projects in windows desktop applications. Assuming my previous experience with commercial IDEs for other programming languages, that should be "make a EXE, DLL, whatever" so that one can easily transfer installation file(s) to another WIndows PC without demanding from prospective application user to install anything particular in order to use the program. (My project is in prototype phase, which means, I want to present the simplest possible version with the simplest input-output design, with minimum effort for application user for the prototype version so far, leaving a more robust development (web deployment which I noticed Pycharm gives support for, through "deploy" menu) for later stages of development.
I have googled through a bunch of sites last week, discovering, installing and using solutions such as pyinstaller, cx_freeze, py2exe, I have tried different options using these tools, none was successful. EXE files or MSI installer files simply dont work, resulting in different error messages.
Now I try to take a look from a higher perspective: hacking around with my Python files, different exe makers, in order to make a simple windows app prototype (as I said I even have no DB underneath) was not my idea of spending time, because I want to focus primarily on development and functionality.So my question is: what do you suggest as a most practical way to make a portable application from my project that could be easily used by ordinary Windows users who know nothing about programming, Python etc...? All those EXE creators use only .py files, although Pycharm creates some extra folders and files in Project explorer. How can Pycharm or any other IDE or even pure scripting help to do it most pragmatic and practical way, even if I have to make such compromise, such as make an installer which downloads Python for app user, or deploy a rudimentary web app (Django?) from Pycharm, without additional demands on app user (only requirement should be having a web browser)?Any suggestion, advice or concrete help would be very helpful! 
Thanks in advance! 
Vladimir
Reply
#2
You say that you have tried pyinstaller and other deployment methods.

You need to share your notes that you took during each process, so that we can
diagnose where your installation went wrong. If you didn't take any notes, you will need to
do so.

I have used PyInstaller in the past for some fairly complicated applications, and have not had issue.
I have even done so from within Pycharm, again without issue.

Matplotlib, however, I seem to recall was not a pleasure to install, and may be causing some issues
when trying to deplore. I will assume you used the instructions at https://pyinstaller.readthedocs.io/en/stable/

If not, try their guide and take notes.

Python as I'm sure you are aware of is an interpreted language, and by nature needs to have an interpreter
bundled along with the application. You can't expect that the proper associations will be present on the target
machine.

As far as running in a browser is concerned, Though I myself have just begun to use it, Flask appears to be
having a good following. Some of the comments I have seen have been praising it as a 'complete' web solution.

You may want to investigate.
Reply
#3
For those who can help with above mention "freezing" apps, I will send the setup.py and log messages made during intended .exe builds. Python environment 3.4.0.  Started project development with the newest 3.5.2., with Pycharm and Anaconda (Anaconda installed because of problems with Scipy incompatibility with Pycharm and Python 3.5. ) but after this problem with deployment arose, uninstalled 3.5.1 and Anaconda, installed 3.4. which solved the Scipy incompatibility problem, but did not solve the deploy problem, anyway upside was that I needed Anaconda no more and tried to keep "clean" 3.4. and Pycharm oriented environment thus trying to avoid further incompatibilities

py2exe:
setup.py content:
from distutils.core import setup
import py2exe

setup(windows=['main.py'])
main.py:
from ClassSystemAggregation import *

from tkinter import *

def method_name():
   sys_agg = SystemAggregation("xy")
   sys_agg.set_life()
   sys_agg.get_table_aggregation_data()

b = Button(text="2AB2EH", command=method_name)
b.pack()
mainloop()
main.log (main.py is the main project script involving Tkinter button and activates chain of methods from other .py classes). Under "import.." below are "ClassSystem","ClassSubsystem" and "ClassLRU" which are names of .py scripts used in project. I repeat it runs OK in Pycharm IDE:
Error:
Traceback (most recent call last):  File "main.py", line 1, in <module>  File "D:\Vlada\projekti\py2exe build\ClassSystemAggregation.py", line 1, in <module>    import ClassSystem  File "D:\Vlada\projekti\py2exe build\ClassSystem.py", line 1, in <module>    import ClassSubsystem  File "D:\Vlada\projekti\py2exe build\ClassSubsystem.py", line 1, in <module>    import ClassLRU  File "D:\Vlada\projekti\py2exe build\ClassLRU.py", line 3, in <module>    from scipy.stats import norm  File "D:\Python34\lib\site-packages\scipy\stats\__init__.py", line 321, in <module>    from .stats import *  File "D:\Python34\lib\site-packages\scipy\stats\stats.py", line 180, in <module>    import scipy.special as special  File "D:\Python34\lib\site-packages\scipy\special\__init__.py", line 601, in <module>    from ._ufuncs import *  File "<loader>", line 10, in <module>  File "<loader>", line 8, in __load ImportError: (No module named 'scipy.special._ufuncs_cxx') 'D:\\Vlada\\projekti\\py2exe build\\dist\\scipy.special._ufuncs.pyd'
Reply
#4
The following seems to have a solution for the 'scipy.special._ufuncs_cxx' error

http://stackoverflow.com/questions/20169...ith-errors
Reply
#5
(Oct-15-2016, 01:00 PM)Larz60+ Wrote: The following seems to have a solution for the 'scipy.special._ufuncs_cxx' error

http://stackoverflow.com/questions/20169...ith-errors
Yes it helped indeed, with a little modification: instead of "includes" of all those related scipy modules, I have only used "package"="scipy" ! Thank You very much!

(Oct-15-2016, 12:31 PM)Larz60+ Wrote: You say that you have tried pyinstaller and other deployment methods.

You need to share your notes that you took during each process, so that we can
diagnose where your installation went wrong. If you didn't take any notes, you will need to
do so.

I have used PyInstaller in the past for some fairly complicated applications, and have not had issue.
I have even done so from within Pycharm, again without issue.

Matplotlib, however, I seem to recall was not a pleasure to install, and may be causing some issues
when trying to deplore. I will assume you used the instructions at https://pyinstaller.readthedocs.io/en/stable/

If not, try their guide and take notes.

Python as I'm sure you are aware of is an interpreted language, and by nature needs to have an interpreter
bundled along with the application. You can't expect that the proper associations will be present on the target
machine.

As far as running in a browser is concerned, Though I myself have just begun to use it, Flask appears to be
having a good following. Some of the comments I have seen have been praising it as a 'complete' web solution.

You may want to investigate.

Some wise people say that when you have the problem it is helpful to write it down. At least I have made my "freezing" problems public, and after You gave me a reasonable hint to try again with step-by-step instructions on pyinstaller installation, suddenly I succeded in "freezing" my project on the first try today! I dont know what I did different this time (I installed Pywin32 and pyinstaller through Pycharm IDE interpreter package window this time) and it works with both "folder" and "single executable" deployment.
However I will stay precautious with all these "freezing" programs because further development of the project could result in new issues, so I will further investigate more towards the more natural ways of python development, going towards web front end leaving Python underneath. So I really appreciate your hint of investigating "Flask" as the next step, and later probably Django since it is naturally related with Pycharm IDE. Yet I would be glad do hear any new opinion on this thread.
Thank you very much, Larz60+!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  multiprocessing advices paul18fr 5 3,062 Jun-07-2022, 04:13 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020