How do I fix this cx_Freeze ValueError? - python

I am trying to create proper program with python which can be executable on a friend's computer. To do this I am using cx_Freeze and following the steps outlined here How can I convert a .py to .exe for Python 3.6?
However when I type python setup.py build in the prompt it gives me the following error. I have googled this but am not sure how to go about fixing it. Thank you for any help in advance.
PS C:\Users\jhgwa> python setup.py build
running build
running build_exe
creating directory build\exe.win-amd64-3.6
copying C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\bases\Console.exe -> build\exe.win-amd64-3.6\Announcement Keyword From Headline Puller.exe
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-stdio-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-stdio-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\python36.dll -> build\exe.win-amd64-3.6\python36.dll
copying C:\Users\jhgwa\Anaconda3\VCRUNTIME140.dll -> build\exe.win-amd64-3.6\VCRUNTIME140.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-math-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-math-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-locale-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-locale-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-string-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-string-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-runtime-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-runtime-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-convert-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-convert-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-time-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-time-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-environment-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-environment-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-process-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-process-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-heap-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-heap-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-conio-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-conio-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-filesystem-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-filesystem-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\win32\lib\win32verstamp.py", line 120, in stamp
bits = [int(i) for i in ver.split(".")]
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\win32\lib\win32verstamp.py", line 120, in <listcomp>
bits = [int(i) for i in ver.split(".")]
ValueError: invalid literal for int() with base 10: '<any number>'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 22, in <module>
executables = executables
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
distutils.core.setup(**attrs)
File "C:\Users\jhgwa\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\jhgwa\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\jhgwa\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\jhgwa\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\jhgwa\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\jhgwa\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\dist.py", line 219, in run
freezer.Freeze()
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\freezer.py", line 617, in Freeze
self._FreezeExecutable(executable)
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\freezer.py", line 226, in _FreezeExecutable
self._AddVersionResource(exe)
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\freezer.py", line 167, in _AddVersionResource
stamp(fileName, versionInfo)
File "C:\Users\jhgwa\Anaconda3\lib\site-packages\win32\lib\win32verstamp.py", line 123, in stamp
raise ValueError("--version must be a.b.c.d (all integers) - got %r" % ver)
ValueError: --version must be a.b.c.d (all integers) - got '<any number>.0.0.0'
PS C:\Users\jhgwa>

In the setup.py file you have to set the value of version to a string, in this example code I just set it to "1.0":
setup(
name = '<app name>',
options = options,
version = "1.0",
description = '<any description>',
executables = executables
)
That should be enough.

Related

Issues in installing pygobject in MacOS

I am trying to install pygobject using pip, even with brew in MacOS, but now successful. I followed guides.
If I use the official installation guide in https://pygobject.readthedocs.io/en/latest/getting_started.html, then I have gtk+3 installed, but when I try to import the library:
python3 -c 'import gi; gi.require_version("Gtk", "3.0"); print("ok")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
This is the output of the installation after using pip3:
(base) khalil presentation (master) >> pip3 install gobject pygobject
Collecting gobject
Downloading gobject-0.1.0-py3-none-any.whl (5.9 kB)
Collecting pygobject
Using cached PyGObject-3.42.1.tar.gz (718 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pycairo>=1.16.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pygobject) (1.20.1)
Building wheels for collected packages: pygobject
Building wheel for pygobject (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/tmpsnfmi_oc
cwd: /private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-install-2saq002f/pygobject_1efb85aba31e4700a39a2c6c52381a62
Complete output (90 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/pygtkcompat
copying pygtkcompat/pygtkcompat.py -> build/lib.macosx-10.9-x86_64-3.6/pygtkcompat
copying pygtkcompat/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygtkcompat
copying pygtkcompat/generictreemodel.py -> build/lib.macosx-10.9-x86_64-3.6/pygtkcompat
creating build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_signalhelper.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_constants.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/pygtkcompat.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_ossighelper.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/importer.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_error.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_gtktemplate.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_propertyhelper.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/types.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/docstring.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/_option.py -> build/lib.macosx-10.9-x86_64-3.6/gi
copying gi/module.py -> build/lib.macosx-10.9-x86_64-3.6/gi
creating build/lib.macosx-10.9-x86_64-3.6/gi/repository
copying gi/repository/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/gi/repository
creating build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/GIMarshallingTests.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/Gdk.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/Pango.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/GdkPixbuf.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/Gtk.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/GLib.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/GObject.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/Gio.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
copying gi/overrides/keysyms.py -> build/lib.macosx-10.9-x86_64-3.6/gi/overrides
running build_ext
pycairo: new API
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
metadata_directory)
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 231, in build_wheel
wheel_directory, config_settings)
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
self.run_setup()
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 268, in run_setup
self).run_setup(setup_script=setup_script)
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 1259, in <module>
main()
File "setup.py", line 1254, in main
zip_safe=False,
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 1088, in run
self._setup_extensions()
File "setup.py", line 1083, in _setup_extensions
add_pycairo(gi_cairo_ext)
File "setup.py", line 1066, in add_pycairo
ext.include_dirs += [get_pycairo_include_dir()]
File "setup.py", line 893, in get_pycairo_include_dir
include_dir = find_path(find_new_api())
File "setup.py", line 848, in find_new_api
import cairo
File "/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/cairo/__init__.py", line 1, in <module>
from ._cairo import * # noqa: F401,F403
ImportError: dlopen(/private/var/folders/t0/_kkpxc35687gknp4d99b9lbr0000gn/T/pip-build-env-8drx7d57/overlay/lib/python3.6/site-packages/cairo/_cairo.cpython-36m-darwin.so, 0x0002): symbol not found in flat namespace '_cairo_append_path'
----------------------------------------
ERROR: Failed building wheel for pygobject
Failed to build pygobject
ERROR: Could not build wheels for pygobject, which is required to install pyproject.toml-based projects
(base) khalil presentation (master) >> ```
Problem solved! Thanks to #rasjani
First, I upgraded to the latest version of python, then I create a new_env using conda:
conda create --name new_env python=3.9.12
conda activate new_env
conda install -c conda-forge pygobject
Solution from: Github

Value error '/anaconda3/lib/libpython3.7.dylib' does not exist?

so I've created a virtual environment in my iterm2 window. this is the ques I asked earlier which has not been solved yet and my app is not running is alias modeso i tried to do the whole process again but it was showing error with plistlib so that was fixed by this answer I tried this whole process again which means I did this all this before but my app was not working so i deleted my py2app and some venv's got deleted to I downloaded miniconda3 again and then it was working until it comes to running the app even in alias mode . but I continued and deleted the dist and build and when I executed
python setup.py py2app but then i got this error
Traceback (most recent call last):
File "setup.py", line 18, in <module>
setup_requires=['py2app'],
File "/Users/divyabansal/divya/lib/python3.7/site-packages/setuptools/__init__.py", line
145, in setup
return distutils.core.setup(**attrs)
File "/Users/divyabansal/miniconda3/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/divyabansal/miniconda3/lib/python3.7/distutils/dist.py", line 966, in
run_commands
self.run_command(cmd)
File "/Users/divyabansal/miniconda3/lib/python3.7/distutils/dist.py", line 985, in
run_command
cmd_obj.run()
File "/Users/divyabansal/divya/lib/python3.7/site-packages/py2app/build_app.py", line 756,
in run
self._run()
File "/Users/divyabansal/divya/lib/python3.7/site-packages/py2app/build_app.py", line 966,
in _run
self.run_normal()
File "/Users/divyabansal/divya/lib/python3.7/site-packages/py2app/build_app.py", line 1074,
in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/Users/divyabansal/divya/lib/python3.7/site-packages/py2app/build_app.py", line 1384,
in create_binaries
mm.mm.run_file(runtime)
File "/Users/divyabansal/divya/lib/python3.7/site-packages/macholib/MachOGraph.py", line 89,
in run_file
raise ValueError("%r does not exist" % (pathname,))
ValueError: '/Users/divyabansal/miniconda3/lib/libpython3.7.dylib'
does not exist
please help me with this problem
Thank You!
This problem can often be fixed by creating a symlink, see here for more.
ln -s /path/to/lib/libpython3.7m.dylib /path/to/lib/libpython3.7.dylib
For the above command replace it with your own path.

python can't install, build pycrypto

When installing "pip3 install pycrypto" I have this error:
creating build/lib.linux-armv7l-3.6/Crypto/Protocol
copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
copying lib/Crypto/Protocol/Chaffing.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
copying lib/Crypto/Protocol/KDF.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
copying lib/Crypto/Protocol/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
creating build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
creating build/lib.linux-armv7l-3.6/Crypto/Signature
copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
copying lib/Crypto/Signature/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
warning: PCTBuildPy: byte-compiling is disabled, skipping.
running build_ext
running build_configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/tmp/pip-build-71pdfh2i/pycrypto':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-71pdfh2i/pycrypto/setup.py", line 456, in <module>
core.setup(**kw)
File "/core.py", line 148, in setup
File "/dist.py", line 955, in run_commands
File "/dist.py", line 974, in run_command
File "/opt/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/install.py", line 545, in run
File "/cmd.py", line 313, in run_command
File "/dist.py", line 974, in run_command
File "/build.py", line 135, in run
File "/cmd.py", line 313, in run_command
File "/dist.py", line 974, in run_command
File "/tmp/pip-build-71pdfh2i/pycrypto/setup.py", line 251, in run
self.run_command(cmd_name)
File "/cmd.py", line 313, in run_command
File "/dist.py", line 974, in run_command
File "/tmp/pip-build-71pdfh2i/pycrypto/setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
----------------------------------------
Command "/opt/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-71pdfh2i/pycrypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-cbi74gir-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-71pdfh2i/pycrypto/
My mount:
root#router2:~# mount
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,size=512K)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
devpts on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /opt type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /tmp/mnt/sda1 type ext4 (rw,relatime,data=ordered)
When using TMPDIR=/opt/tmp pip3 install pycrypto I also have problem (google showed that TMPDIR must be mounted without "noexec"):
creating build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
creating build/lib.linux-armv7l-3.6/Crypto/Signature
copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
copying lib/Crypto/Signature/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
warning: PCTBuildPy: byte-compiling is disabled, skipping.
running build_ext
running build_configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/opt/tmp/pip-build-ve5o0p9a/pycrypto':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py", line 456, in <module>
core.setup(**kw)
File "/core.py", line 148, in setup
File "/dist.py", line 955, in run_commands
File "/dist.py", line 974, in run_command
File "/opt/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/install.py", line 545, in run
File "/cmd.py", line 313, in run_command
File "/dist.py", line 974, in run_command
File "/build.py", line 135, in run
File "/cmd.py", line 313, in run_command
File "/dist.py", line 974, in run_command
File "/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py", line 251, in run
self.run_command(cmd_name)
File "/cmd.py", line 313, in run_command
File "/dist.py", line 974, in run_command
File "/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
----------------------------------------
Command "/opt/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /opt/tmp/pip-xa11ohvn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /opt/tmp/pip-build-ve5o0p9a/pycrypto/
gcc, autoconf, automake, python3-dev, python3-pip, python-crypto, python-cryptography were installed.
opkg install gcc, autoconf automake python3-dev, python3-pip, python-crypto, python-cryptography
I tried set HOME=/opt/tmp and TMPDIR=/opt/tmp
or HOME=/opt/tmp TMPDIR=/opt/tmp pip3 install pycrypto
but the problem is the same as above.
I read https://github.com/Entware-ng/Entware-ng/wiki/Self-installation-of-python-modules and follow it but wasn't successful.
pycrypto is requirement xiaomi component of hass
Please note that this is for python 3 not python 2.
Platform:
Buffalo WZR-1750DHP
Firmware: DD-WRT v3.0-r33006 std (08/03/17)
Please advise how to fix this issue.
Thank you!

ImportError: No module named numpy.distutils.core while installing XGBoost in Windows/Python

I am planning to install the XGBoost package in Python for Windows. After following the instructions mentioned here (How to install xgboost package in python (windows platform)?), I am facing issues during the last step (python setup.py install).
$ python setup.py install --user
Install libxgboost from: ['..\\lib\\xgboost.dll']
running install
running bdist_egg
running egg_info
writing requirements to xgboost.egg-info\requires.txt
writing xgboost.egg-info\PKG-INFO
writing top-level names to xgboost.egg-info\top_level.txt
writing dependency_links to xgboost.egg-info\dependency_links.txt
reading manifest file 'xgboost.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'xgboost\include'
warning: no files found matching '*' under directory 'xgboost\src'
warning: no files found matching '*' under directory 'xgboost\make'
warning: no files found matching '*' under directory 'xgboost\rabit'
warning: no files found matching '*' under directory 'xgboost\lib'
warning: no files found matching '*' under directory 'xgboost\dmlc-core'
warning: no previously-included files matching '*.o' found anywhere in distribut ion
warning: no previously-included files matching '*.a' found anywhere in distribut ion
warning: no previously-included files matching '*.pyo' found anywhere in distrib ution
warning: no previously-included files matching '*.pyc' found anywhere in distrib ution
writing manifest file 'xgboost.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\xgboost
copying build\lib\xgboost\build-python.sh -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\callback.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\compat.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\core.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\libpath.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\plotting.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\rabit.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\sklearn.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\training.py -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\VERSION -> build\bdist.win32\egg\xgboost
copying build\lib\xgboost\__init__.py -> build\bdist.win32\egg\xgboost
byte-compiling build\bdist.win32\egg\xgboost\callback.py to callback.pyc
byte-compiling build\bdist.win32\egg\xgboost\compat.py to compat.pyc
byte-compiling build\bdist.win32\egg\xgboost\core.py to core.pyc
byte-compiling build\bdist.win32\egg\xgboost\libpath.py to libpath.pyc
byte-compiling build\bdist.win32\egg\xgboost\plotting.py to plotting.pyc
byte-compiling build\bdist.win32\egg\xgboost\rabit.py to rabit.pyc
byte-compiling build\bdist.win32\egg\xgboost\sklearn.py to sklearn.pyc
byte-compiling build\bdist.win32\egg\xgboost\training.py to training.pyc
byte-compiling build\bdist.win32\egg\xgboost\__init__.py to __init__.pyc
installing package data to build\bdist.win32\egg
running install_data
copying ..\lib\xgboost.dll -> build\bdist.win32\egg\xgboost
creating build\bdist.win32\egg\EGG-INFO
copying xgboost.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying xgboost.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying xgboost.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying xgboost.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO
copying xgboost.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying xgboost.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
creating 'dist\xgboost-0.6-py2.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing xgboost-0.6-py2.7.egg
creating c:\users\mishraji\appdata\roaming\python\python27\site-packages\xgboost -0.6-py2.7.egg
Extracting xgboost-0.6-py2.7.egg to c:\users\mishraji\appdata\roaming\python\pyt hon27\site-packages
Adding xgboost 0.6 to easy-install.pth file
Installed c:\users\mishraji\appdata\roaming\python\python27\site-packages\xgboos t-0.6-py2.7.egg
Processing dependencies for xgboost==0.6
Searching for scipy
Reading https://pypi.python.org/simple/scipy/
Downloading https://pypi.python.org/packages/52/67/d9ef9b5058d4a9e3f0ae641ec1517 90622cbeb37f157de5773358e2bf3da/scipy-0.19.1.tar.gz#md5=6b4d91b62f1926282b127194 a06b72b3
Best match: scipy 0.19.1
Processing scipy-0.19.1.tar.gz
Writing c:\users\mishraji\appdata\local\temp\easy_install-cxrtxb\scipy-0.19.1\se tup.cfg
Running scipy-0.19.1\setup.py -q bdist_egg --dist-dir c:\users\mishraji\appdata\ local\temp\easy_install-cxrtxb\scipy-0.19.1\egg-dist-tmp-hya72r
c:\users\mishraji\appdata\local\temp\easy_install-cxrtxb\scipy-0.19.1\setup.py:3 23: UserWarning: Unrecognized setuptools command, proceeding with generating Cyt hon sources and expanding templates
warnings.warn("Unrecognized setuptools command, proceeding with "
Traceback (most recent call last):
File "setup.py", line 42, in <module>
url='https://github.com/dmlc/xgboost')
File "C:\Python27\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\install.py", line 67, i n run
self.do_egg_install()
File "C:\Python27\lib\site-packages\setuptools\command\install.py", line 117, in do_egg_install
cmd.run()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 410, in run
self.easy_install(spec, not self.no_deps)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 646, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 697, in install_item
self.process_distribution(spec, dist, deps)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 742, in process_distribution
[requirement], self.local_index, self.easy_install
File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 850, in r esolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 1134, in obtain
return installer(requirement)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 665, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 695, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 876, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1115, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1101, in run_setup
run_setup(setup_script, args)
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 251, in run_s etup
raise
File "C:\Python27\lib\contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 198, in setup _context
yield
File "C:\Python27\lib\contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 169, in save_ modules
saved_exc.resume()
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 144, in resum e
six.reraise(type, exc, self._tb)
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 157, in save_ modules
yield saved
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 198, in setup _context
yield
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 248, in run_s etup
DirectorySandbox(setup_dir).run(runner)
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 278, in run
return func()
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 246, in runne r
_execfile(setup_script, ns)
File "C:\Python27\lib\site-packages\setuptools\sandbox.py", line 47, in _execf ile
exec(code, globals, locals)
File "c:\users\mishraji\appdata\local\temp\easy_install-cxrtxb\scipy-0.19.1\se tup.py", line 416, in <module>
File "c:\users\mishraji\appdata\local\temp\easy_install-cxrtxb\scipy-0.19.1\se tup.py", line 396, in setup_package
ImportError: No module named numpy.distutils.core
However, when I import the package in python, it works without any issue.
import numpy.distutils.core as np
The issue occured because I had two python versions (v 2.7.13) and Enthought Canopy (Python 2.7.11). As Python 2.7.11 already had Numpy package, xgboost got installed successfully.
python setup.py install
For me in a Docker, installing numpy first worked:
RUN pip install numpy==1.8.1
RUN pip install scikit-fmm==0.0.9

F2PY returns ValueError: invalid version number '4.'

I am new to Python and want to be able to use my existing Fortran code and run it from Python. I am trying to compile a small "Hello world" Fortran program using F2PY by following instructions online.
I am working on Windows. So far I have installed Python 2.7.3, NumPy 1.6.1, SciPy 10.1, and MinGW 4.8.
I then tried (amongst other things)
f2py.py -c --compiler=mingw32 --fcompiler=gnu95 -m foo foo.f90
This reports an invalid version number.
ValueError: invalid version number '4.'
If anyone could suggest what is going wrong and what I would need to change to get this to run I would be most grateful. The full output from F2PY is follows:
D:\python\fortran2>f2py.py -c --compiler=mingw32 --fcompiler=gnu95 -m foo foo.f90
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "foo" sources
f2py options: []
f2py:> c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7\foomodule.c
creating c:\docume~1\ajr\locals~1\temp\tmpwvnr2c
creating c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7
Reading fortran codes...
Reading file 'foo.f90' (format:free)
Post-processing...
Block: foo
Block: hello
Post-processing (stage 2)...
Building modules...
Building module "foo"...
Constructing wrapper function "hello"...
hello()
Wrote C/API module "foo" to file "c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7\foomodule.c"
adding 'c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7\fortranobject.c' to sources.
adding 'c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7' to include_dirs.
copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7
copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\docume~1\ajr\locals~1\temp\tmpwvnr2c\src.win32-2.7
build_src: building npy-pkg config files
running build_ext
Traceback (most recent call last):
File "c:\python27\scripts\f2py.py", line 24, in <module>
main()
File "C:\Python27\lib\site-packages\numpy\f2py\f2py2e.py", line 588, in main
run_compile()
File "C:\Python27\lib\site-packages\numpy\f2py\f2py2e.py", line 574, in run_compile
setup(ext_modules = [ext])
File "C:\Python27\lib\site-packages\numpy\distutils\core.py", line 186, in setup
return old_setup(**new_attr)
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\numpy\distutils\command\build.py", line 37, in run
old_build.run(self)
File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\numpy\distutils\command\build_ext.py", line 92, in run
force=self.force)
File "C:\Python27\lib\site-packages\numpy\distutils\ccompiler.py", line 556, in new_compiler
compiler = klass(None, dry_run, force)
File "C:\Python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 127, in __init__
elif self.gcc_version < "4.":
File "C:\Python27\lib\distutils\version.py", line 138, in __cmp__
other = StrictVersion(other)
File "C:\Python27\lib\distutils\version.py", line 40, in __init__
self.parse(vstring)
File "C:\Python27\lib\distutils\version.py", line 107, in parse
raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '4.'
The distutils plugin for mingw32 uses an incompatible version string. In distutils/version.py, line 100, the version string matching regex is
r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$'
Edit the file mingw32ccompiler.py manually and change line 127 to read
elif self.gcc_version < "4.0":

Categories

Resources