[PYTHON] Survey on building and running kivi

Last time, I was able to build! I thought. However, it wasn't an app that worked just because it was built.

I did a lot of research there, so I'll summarize it.

What I learned from the survey results

It turns out that it's not really multi-platform. I was convinced that I could make an app that can use Windows, Mac, and Linux with just one Mac.

Actually, it seems to be different for each development environment due to lack of libraries.

I will write down an example below.

Development environment in the first place

The development environment looks like this.

$ python
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import kivy
[INFO   ] [Logger      ] Record log in /Users/xxxxxxxx/.kivy/logs/kivy_17-02-16_10.txt
[INFO   ] [Kivy        ] v1.9.2.dev0, git-Unknown, 20170210
[INFO   ] [Python      ] v2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

Install all Windows 10 Pro and CentOS 7 on the company machine based on Mac.

For Mac

As mentioned at the beginning, I was able to generate a file with the app extension. However, when I started it, nothing happened, so I wondered what was happening and tried to start it directly.

$ ./dist/xxxx.app/Contents/MacOS/xxxx
 ImportError: No module named importlib
Failed to execute script main

This was the last output. I've been investigating various causes, but in reality, it seems that import was only required on the first line. Is this environment-dependent? (It means that I don't want to use only Mac)

import importlib

Before adding it to the first line, I also tried the following. (For the time being)

$ pip install -U pyobjc-core pyobjc importlib

There is no deep meaning. It is meaningless because it can be started as long as import importlib can be described. However, there are some build errors, so it may be better to run it.

For Windows

You can build on Mac. However, if I bring the exe file built to Windows, it will not start. Apparently windows should be built with windows. That means that if you want to distribute it to a Linux environment, you have to compile it on Linux ... It's good that Android and iOS can be built on Mac as expected, but will it work if Wine that runs Windows on Mac is installed? It is a little annoying part. Or build a virtual machine for build ... (This is the quickest, but it's also expensive)

Sure, I've seen win32com in the build log for a while, but it's a shame that it can't be multi-platform.

And isn't win32com available for Mac? The result of the investigation was this.

COM is Windows only.

Oh ... So, do you want to include Wine at the beginning of this session? I was a little worried, but I don't like Wine (problem remark)

With that said, the next theme will inevitably be building a python development environment using Windows.

For Linux

Linux is the same as Windows, and it seems that you have to build in that environment. I took the file built on Mac to Linux and tried it with the following permissions, but it didn't run.

chmod a+x

If the kernel is different, it may not work, but if you want to do multi-build, can you build without each environment? Fortunately, if you just build other than Windows, it is good because you can prepare a CUI environment.

Still, it is necessary to check the operation, so I wonder if a GUI is necessary.

Conclusion

Prepare an environment with python and kivi installed on each platform. And let's build on each platform.

Next time, "I tried to build an environment for Windows and an environment for Cent OS". I realized that it wouldn't work on Windows if I had a faint idea of playing Shell ... Is the era Ansible? ?? (But how can I run Ansible on a machine on a VM !?)

Recommended Posts

Survey on building and running kivi
Notes on building Python and pyenv on Mac
Notes on building TinyEMU and booting the Linux kernel on Emscripten
Building a Python environment on a Mac and using Jupyter lab
Notes on tf.function and Tracing
Python on Ruby and angry Ruby on Python
Notes on * args and ** kargs
Recording and playback on Linux
Notes on pyenv and Atom
Building Algorithmic Strategies on SmartTrade
Catalina on Mac and pyenv
Everything from building a Python environment to running it on Windows