Closed shift838 closed 3 years ago
You are missing the GTK development packages. See this for the list of prerequisite packages that you need to install: https://github.com/wxWidgets/Phoenix#prerequisites
If you don't want to build wxWidgets/wxPython yourself, you can also just install the python3-wxgtk4.0
package in Ubuntu 20.04 which will get you version 4.0.7.
There are a few more details about what is needed for building on Linux via pip here: https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html
@swt2c I tried installing wxPython
via apt install:
$ sudo apt install python3-wxgtk4.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-wxgtk4.0 is already the newest version (4.0.1+dfsg-2).
python3-wxgtk4.0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
But I still can't import wx
in Python:
$ python
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'wx'
When I try pip install wxPython
, the process spins indefinitely without finishing:
$ pip install wxpython
Collecting wxpython
Using cached wxPython-4.1.1.tar.gz (66.0 MB)
Requirement already satisfied: pillow in ./mac_venv/lib/python3.6/site-packages (from wxpython) (8.3.2)
Requirement already satisfied: six in ./mac_venv/lib/python3.6/site-packages (from wxpython) (1.16.0)
Requirement already satisfied: numpy in ./mac_venv/lib/python3.6/site-packages (from wxpython) (1.19.5)
Building wheels for collected packages: wxpython
Building wheel for wxpython (setup.py)
Is that supposed to happen?
How long is pip install wxPython
normallly supposed to take?
It finished, eventually.
sudo apt install python3-wxgtk4.0
worked
How long is
pip install wxPython
normallly supposed to take?
how long did it take? :(
I had to run this before the pip install would finally work:
sudo apt-get install build-essential libgtk-3-dev
How long is
pip install wxPython
normallly supposed to take?how long did it take? :(
I also encountered the same problem. And the waiting time is so long, I don’t know if it will succeed.
How long is
pip install wxPython
normallly supposed to take?how long did it take? :(
I also encountered the same problem. And the waiting time is so long, I don’t know if it will succeed. Well, after a long long time, about 30 minutes, it completed successfully!!
I had the same problem, installing wxPython through pip had a wait of 20 or 30 minutes on the Building wheel for wxpython (setup.py) ...
step.
I am running Python 3.8.5 on Ubuntu 20.04
When trying to install wxpython via pip3 install wxpython I receive the below errors:
` Collecting wxpython Using cached wxPython-4.1.0.tar.gz (65.8 MB) Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (from wxpython) (7.0.0) Requirement already satisfied: six in /usr/lib/python3/dist-packages (from wxpython) (1.14.0) Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from wxpython) (1.19.2) Building wheels for collected packages: wxpython Building wheel for wxpython (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pqro4_gg/wxpython/setup.py'"'"'; file='"'"'/tmp/pip-install-pqro4_gg/wxpython/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 /tmp/pip-wheel-ga8o1dey cwd: /tmp/pip-install-pqro4_gg/wxpython/ Complete output (142 lines): running bdistwheel running build WARNING: Building this way assumes that all generated files have been generated already. If that is not the case then use build.py directly to generate the source and perform the build stage. You can use --skip-build with the bdist* or install commands to avoid this message and the wxWidgets and Phoenix build steps in the future.
"/usr/bin/python3" -u build.py build Will build using: "/usr/bin/python3" 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] Python's architecture is 64bit cfg.VERSION: 4.1.0
Running command: build Running command: build_wx wxWidgets build options: ['--wxpython', '--unicode', '--gtk3'] Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl'] /tmp/pip-install-pqro4_gg/wxpython/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for toolkit... gtk 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... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether we are using the Intel C compiler... no checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking whether gcc needs -traditional... no checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking whether we are using the Intel C++ compiler... no checking whether we are using the Sun C++ compiler... no checking for ar... ar checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for langinfo.h... yes checking for wchar.h... yes checking for sys/select.h... yes checking for cxxabi.h... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking size of short... 2 checking size of void *... 8 checking size of int... 4 checking size of long... 8 checking size of size_t... 8 checking size of long long... 8 checking size of wchar_t... 4 checking for va_copy... yes checking whether the compiler supports variadic macros... yes checking for _FILE_OFFSET_BITS value needed for large files... 64 checking if large file support is available... yes checking for _LARGEFILE_SOURCE value needed for large files... no checking whether byte ordering is bigendian... no checking for std::wstring in... yes
checking for std::istream... yes
checking for std::ostream... yes
checking for type_traits... yes
checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... yes
checking for libraries directories... /usr/lib/x86_64-linux-gnu /usr/lib
checking for cos... no
checking for floor... no
checking if floating point functions link without -lm... no
checking for sin... yes
checking for ceil... yes
checking if floating point functions link with -lm... yes
checking for strtoull... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: WARNING: Defaulting to the builtin regex library for Unicode build.
checking for zlib.h >= 1.1.4... yes
checking for zlib.h... (cached) yes
checking for deflate in -lz... yes
checking for png.h > 0.90... no
checking for png.h... (cached) no
configure: WARNING: system png library not found or too old, will use built-in instead
checking for jpeglib.h... no
configure: WARNING: system jpeg library not found, will use built-in instead
checking lzma.h usability... no
checking lzma.h presence... no
checking for lzma.h... no
checking for jbg_dec_init in -ljbig... no
checking for LIBTIFF... not found via pkg-config
checking for tiffio.h... no
configure: WARNING: system tiff library not found, will use built-in instead
checking for expat.h... yes
checking if expat.h is valid C++ header... yes
checking for XML_ParserCreate in -lexpat... yes
checking for GTK+ version...
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.16... yes
checking for GTK+ - version >= 3.0.0... Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing
gtk+-3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+-3.0' found Package gthread-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing
gthread-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gthread-2.0' found no Could not run GTK+ test program, checking why... The test program failed to compile or link. See the file config.log for the *** exact error that occurred. This usually means GTK+ is incorrectly installed. configure: error: The development files for GTK+ were not found. For GTK+ 2, please ensure that pkg-config is in the path and that gtk+-2.0.pc is installed. For GTK+ 1.2 please check that gtk-config is in the path, and that the version is 1.2.3 or above. Also check that the libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config --libs' are in the LD_LIBRARY_PATH or equivalent.Error running configure ERROR: failed building wxWidgets Traceback (most recent call last): File "build.py", line 1471, in cmd_build_wx wxbuild.main(wxDir(), build_options) File "/tmp/pip-install-pqro4_gg/wxpython/buildtools/build_wxwidgets.py", line 372, in main exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts), File "/tmp/pip-install-pqro4_gg/wxpython/buildtools/build_wxwidgets.py", line 85, in exitIfError raise builder.BuildError(msg) buildtools.builder.BuildError: Error running configure Finished command: build_wx (0m3.154s) Finished command: build (0m3.154s) Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.
ERROR: Failed building wheel for wxpython Running setup.py clean for wxpython Failed to build wxpython Installing collected packages: wxpython Running setup.py install for wxpython ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pqro4_gg/wxpython/setup.py'"'"'; file='"'"'/tmp/pip-install-pqro4_gg/wxpython/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-record-8nsn698t/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/wxpython cwd: /tmp/pip-install-pqro4gg/wxpython/ Complete output (142 lines): running install running build WARNING: Building this way assumes that all generated files have been generated already. If that is not the case then use build.py directly to generate the source and perform the build stage. You can use --skip-build with the bdist* or install commands to avoid this message and the wxWidgets and Phoenix build steps in the future.
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pqro4_gg/wxpython/setup.py'"'"'; file='"'"'/tmp/pip-install-pqro4_gg/wxpython/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-record-8nsn698t/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/wxpython Check the logs for full command output.
`