Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message: no base named 'console' ('console-cpython-311-win_amd64') for python 3.11 #2392

Closed
jpotter0 opened this issue May 12, 2024 · 25 comments

Comments

@jpotter0
Copy link

jpotter0 commented May 12, 2024

I am trying to build an executable from my python code. I created a setup.py file. This file is the same as one that worked previously under version 6.15.16 except I added two exclusions for matplotlib and pyvista. My code has no plots and runs correctly in PyCharm except for warnings about matplotlib and pyvista, which i don't want my executable users to see.

from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but some modules need manual configuration
build_exe_options = {"packages": ["os"], "excludes": ["tkinter","pyvista","matplotlib"],"include_files": [
        ("C:\\Users\\jpotter\\AppData\\Local\\Programs\\Python\\Python311\\python3.dll", "python3.dll"), 
        ("C:\\Users\\jpotter\\AppData\\Local\\Programs\\Python\\Python311\\python311.dll", "python311.dll")]}

setup(
    name = "CoilCalc",
    version = "0.3",
    description = "My CoilCalc application!",
    options = {"build_exe": build_exe_options},
    executables = [Executable("CoilCalc.py")]
)

I have tried various ploys such as setting base to "console"and "None". but the above script should work since "console" is the default according to the documentation.

I have used pip to install v 7.0. I downloaded the source from PiPy and recompiled it. Then I downloaded the source from the Git cx-freeze repository. That got my hopes ups since it was version 7.1.0. But all yield exactly the same error:
(venv) c:\Users\jpotter\PycharmProjects\pythonProject5>python setup.py build

Traceback (most recent call last):
  File "c:\Users\jpotter\PycharmProjects\pythonProject5\setup.py", line 13, in <module>
    executables = [Executable("CoilCalc.py")]
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Dev\cx_Freeze\venv\Lib\site-packages\cx_freeze-7.1.0.dev0-py3.11-win-amd64.egg\cx_Freeze\executable.py", line 47, in __init__
    self.base = base
    ^^^^^^^^^
  File "c:\Dev\cx_Freeze\venv\Lib\site-packages\cx_freeze-7.1.0.dev0-py3.11-win-amd64.egg\cx_Freeze\executable.py", line 87, in base
    raise OptionError(msg)
cx_Freeze.exception.OptionError: no base named 'console' ('console-cpython-311-win_amd64')

After all I have been through the conclusion I have come to is that base="console" is missing from the installation, The base directory contains:

 Directory of c:\Users\jpotter\PycharmProjects\pythonProject5\venv\Lib\site-packages\cx_freeze\bases

05/12/2024  02:14 AM    <DIR>          .
05/12/2024  02:14 AM    <DIR>          ..
05/12/2024  02:13 AM            17,920 Win32GUI-cpython-311-win_amd64.exe
05/12/2024  02:13 AM            26,624 Win32Service-cpython-311-win_amd64.exe
05/12/2024  02:13 AM                68 __init__.py
05/12/2024  02:14 AM    <DIR>          __pycache__
               3 File(s)         44,612 bytes
               3 Dir(s)  1,211,067,854,848 bytes free

I am at a loss about how to solve this problem. Suggestions are greatly appreciated.

Jim

@jpotter0
Copy link
Author

I am running CPython v3.11 on Windows 11 with current updates on an i913900 CPU.. My program is in a virtual environment.

@marcelotduarte
Copy link
Owner

There must have been an error when installing cx_Freeze. In the bases folder you must have the console file. In fact, I downloaded the file directly from Pypi and saw that it is correct.
I suggest uninstalling and force installing. Also check that there is no antivirus interfering with the installation.
pip uninstall -y cx_Freeze
pip install cx_Freeze --no-cache --force

In case you tried to download the sources, you have to have MS VC to compile, otherwise it will go wrong,

@jpotter0
Copy link
Author

jpotter0 commented May 13, 2024 via email

@marcelotduarte
Copy link
Owner

I did follow the instructions for downloading the compiler.

I'm not recommending this, I just said that you need the C compiler to compile from sources. I really recommend trying to use pip again, cleaning the previous installation, and if possible even creating a new venv.
Another possibility is to use the development version, which I should release in a few days:
pip install --force --no-cache --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze

@jpotter0
Copy link
Author

jpotter0 commented May 13, 2024 via email

@marcelotduarte
Copy link
Owner

I get a 'permission denied' error when I try to reinstall cx_Freeze, even though I opened the Command Line Interpreter as an administrator. I have been having this problem all along. A workaround has been to reboot my computer. This is probably a Windows 11 problem.

I think it could be the antivirus. See this recent case: #2383

I guess I'll remove the two exclusions from the setup.py file

If it works, and you do not need them, you can use them in 'excludes'.

I also get a message that CPython is required, which is odd since the program is written in CPython. Should I put CPython in the includes list?

No. But, I vote to you remove .dll in "include_files". cx_Freeze detects the required dependencies.

Are you using Python from the Windows Store?

@jpotter0
Copy link
Author

jpotter0 commented May 13, 2024 via email

@jpotter0
Copy link
Author

jpotter0 commented May 13, 2024 via email

@jpotter0
Copy link
Author

jpotter0 commented May 13, 2024 via email

@jpotter0
Copy link
Author

Bitdefender claims to have found a virus in the bases\console file. It has identified it as Gen:Variant.Tedy579949. I have had experience with virus protection programming programs overreacting to innocuous files. However, my program will have a user for the exe file. I can't risk sending an infected program to him. I will put some effort into finding out if the problem is real. How do I get a guaranteed clean copy of bases\console-cpython-311-win_amd64.exe?

@marcelotduarte
Copy link
Owner

The process is automatic via CI: https://github.com/marcelotduarte/cx_Freeze/actions/runs/8771749472/job/24070083583

Another option is building it. You need MS VC compiler.

@jpotter0
Copy link
Author

jpotter0 commented May 14, 2024

I followed your instructions for getting the files from a trusted source. It now works fine. I checked my exe file with Bitdefender and it does not find a virus. Thanks for your help!

@marcelotduarte
Copy link
Owner

Are you saying that using pip, Bitdefender reported it as a virus and you directly downloaded the wheel from github, you had no problems?

@jpotter0
Copy link
Author

Wherever it came from per your instructions to the other guy who is having the same problem. I have a 1 hour conference call coming up on the hour (1 PM MDT).

@jpotter0
Copy link
Author

When I checked the executable with Bit defender it showed that the file was clean. The versions I installed with pip install with no special instructions about the source appear to be infected.

@jpotter0
Copy link
Author

jpotter0 commented May 14, 2024 via email

@jpotter0
Copy link
Author

jpotter0 commented May 16, 2024 via email

@marcelotduarte
Copy link
Owner

The python dlls are automatically copied. The dependencies for some modules and packages, sometimes we need to copy them or make a hook to copy them.
Do you a sample with the module pyaedt? I'll make a hook for it.

@jpotter0
Copy link
Author

I'm not sure what you mean. I am restoring my setup file to its original configuration. I thought I did, but I made an error in the way I listed the include files. I will retry that. I will revert to my original file, which didn't exclude pyvista and matplotlib:

from cx_Freeze import setup, Executable

Dependencies are automatically detected, but some modules need manual configuration

build_exe_options = {"packages": ["os"], "excludes": ["tkinter"],"include_files": [
("C:\Users\jpotter\AppData\Local\Programs\Python\Python311\python3.dll", "python3.dll"),
("C:\Users\jpotter\AppData\Local\Programs\Python\Python311\python311.dll", "python311.dll")]}

setup(
name = "CoilCalc",
version = "1.0.3",
description = "My CoilCalc application!",
options = {"build_exe": build_exe_options},
executables = [Executable("CoilCalc.py")]
)

@marcelotduarte
Copy link
Owner

marcelotduarte commented May 16, 2024

A small code to demostrate the use or to reproduce the error. For instance, to demonstrate the use of cx_Freeze with matplotlib, we have https://github.com/marcelotduarte/cx_Freeze/tree/main/samples/matplotlib_tk, so if you have a small sample to reproduce your case using pyaedt...

@jpotter0
Copy link
Author

jpotter0 commented May 21, 2024 via email

@marcelotduarte
Copy link
Owner

You're welcome. I'm glad you managed to resolve it. I'll close the issue then.

@marcelotduarte
Copy link
Owner

Release 7.1.0 is out!
Documentation

@jpotter0
Copy link
Author

jpotter0 commented May 26, 2024 via email

@marcelotduarte
Copy link
Owner

Or, you can use bdist_msi.
There are examples in the samples directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants