ahmed mellouk
ahmed mellouk

Reputation: 87

cx_freeze doesn't get installed in python 3.8.0

I'm trying to install cx_freeze to convert my python code into an executable. But it always shows the error below.

I looked into the problem and found that I should downgrade my python version because there is no cx_freeze that supports Python 3.8.

NOTE
It turns out that cx_freeze installation on Python 3.8 is possible if you download the development version directly from Git.

 Using cached https://files.pythonhosted.org/packages/14/74/a76c12e4e357c79999191d5db259e66b46c57708515395c023d38e6bbbd7/cx_Freeze-6.0.tar.gz
Building wheels for collected packages: cx-freeze
 Building wheel for cx-freeze (setup.py) ... error
 ERROR: Command errored out with exit status 1:
  command: 'c:\users\lenovo\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-wncuyyho\\cx-freeze\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-wncuyyho\\cx-freeze\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\lenovo\AppData\Local\Temp\pip-wheel-59n38z49' --python-tag cp38
      cwd: C:\Users\lenovo\AppData\Local\Temp\pip-install-wncuyyho\cx-freeze\
 Complete output (70 lines):
 running bdist_wheel
 running build
 running build_py
 creating build
 creating build\lib.win-amd64-3.8
 creating build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\common.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\dist.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\finder.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\freezer.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\hooks.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\macdist.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\main.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\setupwriter.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\windist.py -> build\lib.win-amd64-3.8\cx_Freeze
 copying cx_Freeze\__init__.py -> build\lib.win-amd64-3.8\cx_Freeze
 creating build\lib.win-amd64-3.8\cx_Freeze\initscripts
 copying cx_Freeze\initscripts\Console.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
 copying cx_Freeze\initscripts\ConsoleSetLibPath.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
 copying cx_Freeze\initscripts\SharedLib.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
 copying cx_Freeze\initscripts\SharedLibSource.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
 copying cx_Freeze\initscripts\__startup__.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
 creating build\lib.win-amd64-3.8\cx_Freeze\samples
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
 copying cx_Freeze\samples\advanced\advanced_1.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
 copying cx_Freeze\samples\advanced\advanced_2.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
 copying cx_Freeze\samples\advanced\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\asmodule
 copying cx_Freeze\samples\asmodule\asmodule.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\asmodule
 copying cx_Freeze\samples\asmodule\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\asmodule
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
 copying cx_Freeze\samples\importlib\get_examples.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
 copying cx_Freeze\samples\importlib\server_simple.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
 copying cx_Freeze\samples\importlib\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
 copying cx_Freeze\samples\importlib\web_srv.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
 copying cx_Freeze\samples\importlib\wsgiserver.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\matplotlib
 copying cx_Freeze\samples\matplotlib\matplotlib_eg.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\matplotlib
 copying cx_Freeze\samples\matplotlib\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\matplotlib
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\openpyxl
 copying cx_Freeze\samples\openpyxl\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\openpyxl
 copying cx_Freeze\samples\openpyxl\test_openpyxl.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\openpyxl
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt4
 copying cx_Freeze\samples\PyQt4\PyQt4app.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt4
 copying cx_Freeze\samples\PyQt4\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt4
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt5
 copying cx_Freeze\samples\PyQt5\PyQt5app.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt5
 copying cx_Freeze\samples\PyQt5\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt5
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\relimport
 copying cx_Freeze\samples\relimport\relimport.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\relimport
 copying cx_Freeze\samples\relimport\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\relimport
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\service
 copying cx_Freeze\samples\service\Config.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\service
 copying cx_Freeze\samples\service\ServiceHandler.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\service
 copying cx_Freeze\samples\service\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\service
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\simple
 copying cx_Freeze\samples\simple\hello.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\simple
 copying cx_Freeze\samples\simple\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\simple
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\Tkinter
 copying cx_Freeze\samples\Tkinter\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\Tkinter
 copying cx_Freeze\samples\Tkinter\SimpleTkApp.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\Tkinter
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\wx
 copying cx_Freeze\samples\wx\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\wx
 copying cx_Freeze\samples\wx\wxapp.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\wx
 creating build\lib.win-amd64-3.8\cx_Freeze\samples\zope
 copying cx_Freeze\samples\zope\qotd.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\zope
 copying cx_Freeze\samples\zope\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\zope
 running build_ext
 building 'cx_Freeze.util' extension
 error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
 ----------------------------------------
 ERROR: Failed building wheel for cx-freeze
 Running setup.py clean for cx-freeze
Failed to build cx-freeze
Installing collected packages: cx-freeze
 Running setup.py install for cx-freeze ... error
   ERROR: Command errored out with exit status 1:
    command: 'c:\users\lenovo\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-wncuyyho\\cx-freeze\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-wncuyyho\\cx-freeze\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lenovo\AppData\Local\Temp\pip-record-42p9qoxu\install-record.txt' --single-version-externally-managed --compile
        cwd: C:\Users\lenovo\AppData\Local\Temp\pip-install-wncuyyho\cx-freeze\
   Complete output (70 lines):
   running install
   running build
   running build_py
   creating build
   creating build\lib.win-amd64-3.8
   creating build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\common.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\dist.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\finder.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\freezer.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\hooks.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\macdist.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\main.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\setupwriter.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\windist.py -> build\lib.win-amd64-3.8\cx_Freeze
   copying cx_Freeze\__init__.py -> build\lib.win-amd64-3.8\cx_Freeze
   creating build\lib.win-amd64-3.8\cx_Freeze\initscripts
   copying cx_Freeze\initscripts\Console.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
   copying cx_Freeze\initscripts\ConsoleSetLibPath.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
   copying cx_Freeze\initscripts\SharedLib.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
   copying cx_Freeze\initscripts\SharedLibSource.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
   copying cx_Freeze\initscripts\__startup__.py -> build\lib.win-amd64-3.8\cx_Freeze\initscripts
   creating build\lib.win-amd64-3.8\cx_Freeze\samples
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
   copying cx_Freeze\samples\advanced\advanced_1.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
   copying cx_Freeze\samples\advanced\advanced_2.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
   copying cx_Freeze\samples\advanced\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\advanced
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\asmodule
   copying cx_Freeze\samples\asmodule\asmodule.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\asmodule
   copying cx_Freeze\samples\asmodule\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\asmodule
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
   copying cx_Freeze\samples\importlib\get_examples.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
   copying cx_Freeze\samples\importlib\server_simple.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
   copying cx_Freeze\samples\importlib\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
   copying cx_Freeze\samples\importlib\web_srv.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
   copying cx_Freeze\samples\importlib\wsgiserver.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\importlib
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\matplotlib
   copying cx_Freeze\samples\matplotlib\matplotlib_eg.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\matplotlib
   copying cx_Freeze\samples\matplotlib\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\matplotlib
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\openpyxl
   copying cx_Freeze\samples\openpyxl\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\openpyxl
   copying cx_Freeze\samples\openpyxl\test_openpyxl.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\openpyxl
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt4
   copying cx_Freeze\samples\PyQt4\PyQt4app.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt4
   copying cx_Freeze\samples\PyQt4\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt4
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt5
   copying cx_Freeze\samples\PyQt5\PyQt5app.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt5
   copying cx_Freeze\samples\PyQt5\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\PyQt5
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\relimport
   copying cx_Freeze\samples\relimport\relimport.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\relimport
   copying cx_Freeze\samples\relimport\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\relimport
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\service
   copying cx_Freeze\samples\service\Config.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\service
   copying cx_Freeze\samples\service\ServiceHandler.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\service
   copying cx_Freeze\samples\service\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\service
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\simple
   copying cx_Freeze\samples\simple\hello.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\simple
   copying cx_Freeze\samples\simple\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\simple
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\Tkinter
   copying cx_Freeze\samples\Tkinter\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\Tkinter
   copying cx_Freeze\samples\Tkinter\SimpleTkApp.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\Tkinter
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\wx
   copying cx_Freeze\samples\wx\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\wx
   copying cx_Freeze\samples\wx\wxapp.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\wx
   creating build\lib.win-amd64-3.8\cx_Freeze\samples\zope
   copying cx_Freeze\samples\zope\qotd.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\zope
   copying cx_Freeze\samples\zope\setup.py -> build\lib.win-amd64-3.8\cx_Freeze\samples\zope
   running build_ext
   building 'cx_Freeze.util' extension
   error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
   ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lenovo\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-wncuyyho\\cx-freeze\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-wncuyyho\\cx-freeze\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lenovo\AppData\Local\Temp\pip-record-42p9qoxu\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Upvotes: 0

Views: 4325

Answers (1)

K.Mulier
K.Mulier

Reputation: 9620

I had the exact same problem. This is how to solve it:

 

1. Install Visual Studio Community Edition

You need the C++ compiler for Windows 10. Download **Visual Studio 2019 Community** from https://visualstudio.microsoft.com/downloads/

enter image description here

Double click the downloaded installer. You should now see the following window (after a bit of waiting and a bit of clicking next):

enter image description here

That's the place where you should select the "things" that you want to include in your Visual Studio installation. The only thing you need right now is Desktop development with C++. After selecting that, you should see Installation details appear on the right side. There are already a few entries selected there (marked as Automatically selected in my screenshot above). You need to manually select the two last entries. Now click the Install button in the down-right corner.

Now have some patience while the installation progresses:

enter image description here

At the end, the installer will ask you to restart your computer. Click OK. That's it.

 

2. Install cx_freeze

*Just a reminder: make sure you have an updated `pip`. Issue the command:*
*`python -m pip install --upgrade pip`*

cx_freeze does not yet support Python 3.8. Luckily, the development version already has a fix. So you should not run pip install cx_freeze, but the following command instead:

pip install --upgrade git+https://github.com/anthony-tuininga/cx_Freeze.git@master

On my computer, the installation was successfull:

C:\Users\Kristof>pip install --upgrade git+https://github.com/anthony-tuininga/cx_Freeze.git@master
Collecting git+https://github.com/anthony-tuininga/cx_Freeze.git@master
  Cloning https://github.com/anthony-tuininga/cx_Freeze.git (to revision master) to c:\users\kristof\appdata\local\temp\pip-req-build-7hrolrl1
  Running command git clone -q https://github.com/anthony-tuininga/cx_Freeze.git 'C:\Users\Kristof\AppData\Local\Temp\pip-req-build-7hrolrl1'
Building wheels for collected packages: cx-Freeze
  Building wheel for cx-Freeze (setup.py) ... done
  Created wheel for cx-Freeze: filename=cx_Freeze-6.1-cp38-cp38-win_amd64.whl size=173005 sha256=507c3b90a1b7945fc277ccf25a5e4be7c64a37e1a1f6bce3f5171434c823fc04
  Stored in directory: C:\Users\Kristof\AppData\Local\Temp\pip-ephem-wheel-cache-p7vebfjn\wheels\30\8c\fc\66fc4c5a5e2a27aa97f29d147cee6bd5d1198260ae9d1e9102
Successfully built cx-Freeze
Installing collected packages: cx-Freeze
Successfully installed cx-Freeze-6.1

 

3. Install cx_freeze on Python 3.9

I came back to this question after several months. I've got Python 3.9 now. Please note that cx_Freeze has changed its github path and also switched from master to main branch. This is how to install the main branch now:

> pip install git+https://github.com/marcelotduarte/cx_Freeze.git@main

Collecting git+https://github.com/marcelotduarte/cx_Freeze.git@main
  Cloning https://github.com/marcelotduarte/cx_Freeze.git (to revision main) to c:\users\gebruiker\appdata\local\temp\pip-req-build-ah6qsibk
  Running command git clone -q https://github.com/marcelotduarte/cx_Freeze.git 'C:\Users\Gebruiker\AppData\Local\Temp\pip-req-build-ah6qsibk'
  Running command git submodule update --init --recursive -q
Requirement already satisfied: importlib_metadata>=3.1.1 in c:\python39\lib\site-packages (from cx-Freeze==6.6.dev0) (3.6.0)
Requirement already satisfied: zipp>=0.5 in c:\python39\lib\site-packages (from importlib_metadata>=3.1.1->cx-Freeze==6.6.dev0) (3.4.0)
Building wheels for collected packages: cx-Freeze
  Building wheel for cx-Freeze (setup.py) ... done
  Created wheel for cx-Freeze: filename=cx_Freeze-6.6.dev0-cp39-cp39-win_amd64.whl size=260212 sha256=48855a055f9834fb666831b9ae4ff08aaa93276f9c91339614a4f58656d0bd47
  Stored in directory: C:\Users\Gebruiker\AppData\Local\Temp\pip-ephem-wheel-cache-flvt95bk\wheels\e4\58\28\02e3273cbbf0d18134fd22f6766cfdbc1b9f6b2946d5d75940
Successfully built cx-Freeze
Installing collected packages: cx-Freeze
Successfully installed cx-Freeze-6.6.dev0

Upvotes: 2

Related Questions