I'm trying to package an auto updating python 3 application using esky, but cannot get it to work on windows.
I'm trying to get the simplest example from the tutorial to work.
https://github.com/cloudmatrix/esky/tree/master/tutorial/stage1
My environment:
Z:\share_space\esky-master\tutorial\stage1>python --version
Python 3.4.3
Z:\share_space\esky-master\tutorial\stage1>pip freeze
...
cx-Freeze==4.3.4
esky==0.9.8
py2exe==0.9.2.2
...
When run using py2exe as the freezer, it fails to find the py2exe module for some reason (though freezing other apps with "python setup.py py2exe" works just fine).
Z:\share_space\esky-master\tutorial\stage1>python setup.py bdist_esky
running bdist_esky
Traceback (most recent call last):
File "setup.py", line 17, in <module>
"freezer_module":"py2exe",
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 973, in run_command
cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Python34\lib\site-packages\esky\bdist_esky\__init__.py", line 291, in
finalize_options
raise RuntimeError(err)
RuntimeError: freezer module not found: 'py2exe'
With cx-Freeze building the package works well but running the executable fails.
Z:\share_space\esky-master\tutorial\stage1>dist\example-app-0.1.win32\example.ex
e
ValueError: bad marshal data (unknown type code)
Fatal Python error: unable to locate initialization module
Current thread 0x00001254 (most recent call first):
In order got get a working windows build you need the following:
The latest esky version from github (not pypi).
To circumvent an esky bug ensure the character case of dependencies listed with pip freeze are correct and reinstall if not.
I can confirm using cx-Freeze works (py2exe not tested yet).
See this github issue as to how the problem was resolved.
Related
I am trying to build a Python package, but it gives the following error.
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting dependencies for sdist...
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 351, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 285, in get_requires_for_build_sdist
return hook(config_settings)
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_sdist
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 482, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 5, in <module>
ModuleNotFoundError: No module named 'pathlib2'
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist
I have already installed pathlib2. What is the solution?
I have successfully build this in Python3.10. pip3.10 freeze gave me this output
build==0.8.0
packaging==21.3
pep517==0.13.0
pyparsing==3.0.9
tomli==2.0.1
As per the official documentation of the build package, it does not have a stable compatibility
https://pypa-build.readthedocs.io/en/latest/installation.html#compatibility
You can try switching to an older version of python (3.9 recommended) and try again,
ideally, that should solve the error since in traceback, the error seems to originate from setuptools ( which will be automatically reverted back to an older version with a older python version )
NOTE: You will also need to reinstall build in the new python version
Let me know if you face any issues with it.
I'm attempting to briefcase a hello-world type script, from a virtual environment created using pipenv. My original python installation building using Anaconda, though I don't really need it as I don't use any of the scientific computing stack. I am not sure what I'm experiencing is a pipenv error, a pip error, or a briefcase error. If you could help me sort this, I would really appreciate it.
Briefcase
(root) C:\Users\stmwr\Dropbox\SoftwareProjects\helloworld-br\helloworld>python setup.py windows
running windows
Traceback (most recent call last):
File "setup.py", line 73, in <module>
'app_requires': [
File "C:\Users\stmwr\Anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "C:\Users\stmwr\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\stmwr\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\stmwr\Anaconda3\lib\distutils\dist.py", line 973, in run_command
cmd_obj.ensure_finalized()
File "C:\Users\stmwr\Anaconda3\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\stmwr\Anaconda3\lib\site-packages\briefcase\windows.py", line 18, in finalize_options
finalized = self.get_finalized_command('app')
File "C:\Users\stmwr\Anaconda3\lib\distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Users\stmwr\Anaconda3\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\stmwr\Anaconda3\lib\site-packages\briefcase\app.py", line 123, in finalize_options
pip.utils.ensure_dir(self.download_dir)
AttributeError: module 'pip' has no attribute 'utils'
It's likely that this is an issue with Pipenv not supporting Pip 10 yet; in Pip 10, all internal APIs were moved around, which broke all applications that depended on them. I believe the aim is to have a release out soon.
If you can wait a couple of days and then update Pipenv, that will probably be easiest. If you can't wait, you could try to downgrade Pip to version 9.0.3, which should work again.
Failed to install sqlite wrapper. Any help with installation will be really helpful.
Downloaded from
Installed sqlite3.version
'2.6.0'
Please find the error log below-
sudo python setup.py install test
running install
running build
running build_ext
SQLite: Using system sqlite include/libraries
running install_lib
running install_egg_info
Removing /Library/Python/2.7/site-packages/apsw-3.7.16.2_r1-py2.7.egg-info
Writing /Library/Python/2.7/site-packages/apsw-3.7.16.2_r1-py2.7.egg-info
running test
Traceback (most recent call last):
File "setup.py", line 857, in <module>
'win64hackvars': win64hackvars}
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 102, in run
import tests
File "/Users/tj/Downloads/apsw-3.7.16.2-r1/tests.py", line 9, in <module>
import apsw
ImportError: dlopen(/Users/tj/Downloads/apsw-3.7.16.2-r1/apsw.so, 2): Symbol not found: _sqlite3_db_filename
Referenced from: /Users/tj/Downloads/apsw-3.7.16.2-r1/apsw.so
Expected in: flat namespace
in /Users/tj/Downloads/apsw-3.7.16.2-r1/apsw.so
It is picking up the system SQLite shared library which is an older version. MacOS tends to ignore the SQLite library you want it to use and force using a known system one. (Many OS components like CoreData depend on SQLite which is why they like to force using a known good version.)
The easiest fix is to use the command line as specified in the documentation. It ensures a private copy of SQLite is embedded in the extension and hence will always work.
http://apidoc.apsw.googlecode.com/hg/build.html#recommended
python setup.py fetch --all build --enable-all-extensions install test
(I'm the APSW author). BTW there is a python-sqlite mailing list which you may find useful.
I was playing around with py2app on Snow Leopard(10.6) and I'm running into a few problems when I run
python setup.py py2app
I get the following error :-
% python setup.py py2app
running py2app
Traceback (most recent call last):
File "setup.py", line 18, in <module>
setup_requires=['py2app'],
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Library/Python/2.6/site-packages/py2app-0.7.3-py2.6.egg/py2app/build_app.py", line 502, in run
if sysconfig.get_config_var('PYTHONFRAMEWORK') is None:
AttributeError: 'NoneType' object has no attribute 'get_config_var'
I had installed py2app as per the documentation here, however it seems there are a few environment variables that I haven't set. I also tried cloning a few projects, like the one here and I end up with the same error.
Could someone point me to the documentation that mentioned how I'm supposed to configure py2app before use? Thanks.
That py2app documentation is ancient; what you should be using is here.
As you can see from the stack trace you pasted, something is causing distutils.sysconfig to be None. It looks like you're using the system versions of Python and distutils, which work just fine for me on 10.6.8:
% /usr/bin/python -c "from distutils import sysconfig; print sysconfig.get_config_var('PYTHONFRAMEWORK')"
Python
So if you get a different result from above, you could start there, otherwise you can start debugging the py2app code to see why sysconfig is None.
It is a bug in py2app, a quick workaround: in build_app.py (see the traceback in the question for its location) at line 25 change "sysconfig = None" to "from distutils import sysconfig".
I've filed an issue in py2app's tracker[1] and will do a new release soonish (once I've had time to create and test a patch).
[1] https://bitbucket.org/ronaldoussoren/py2app/issue/96/py2app-doesnt-work-with-python-26-anymore
I am trying to install distribute using ActivePython 3.1.2 on Windows.
Running python distribute_setup.py as described on the cheese shop give me:
No setuptools distribution found
running install
Traceback (most recent call last):
File "setup.py", line 177, in
scripts = scripts,
File "C:\Dev\Python_x86\3.1\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Dev\Python_x86\3.1\lib\distutils\dist.py", line 919, in run_commands
self.run_command(cmd)
File "C:\Dev\Python_x86\3.1\lib\distutils\dist.py", line 938, in run_command
cmd_obj.run()
File "build\src\setuptools\command\install.py", line 73, in run
self.do_egg_install()
File "build\src\setuptools\command\install.py", line 82, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "build\src\setuptools\dist.py", line 361, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "build\src\pkg_resources.py", line 1953, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "build\src\setuptools\command\easy_install.py", line 16, in
from setuptools.sandbox import run_setup
File "build\src\setuptools\sandbox.py", line 164, in
fromlist=['name']).file)
AttributeError: 'module' object has no attribute 'file'
Something went wrong during the installation.
See the error message above.
Is there possibly an unknown dependency that I'm missing?
Downloading the source tarball and executing python setup.py install produces the exact same output.
Edit: Added the full stack trace for running the installer.
So apparently the python.org version of Python3 is different from the ActiveState version of Python3. (You should file a bug to someone (I'm not sure to whom))
The fix I have (I'm not sure of all the repercussions)
Download:
http://pypi.python.org/packages/source/d/distribute/distribute-0.6.12.tar.gz#md5=5a52e961f8d8799d243fe8220f9d760e
and then extracting it and modify:
distribute-0.6.12\setuptools\sandbox.py:165
from:
except ImportError:
to
except (ImportError, AttributeError):
that will silence the error and allow you to run:
python setup.py install
It took me awhile to find a package from http://pypi.python.org/pypi?:action=browse&c=533&show=all that would actually install on either version of Python3. "files" was the first package, and since it installed I am pretty sure that easy_install is working for both copies of Python3.
...hope it works! (That's all I can help you with)
this is a bug with Distribute http://bitbucket.org/tarek/distribute/issue/151 ... it should be fixed by next release (0.6.13). It is only reproducible with PyWin32 installed; and ActivePython comes bundled with PyWin32.