JustSayIt.jl
JustSayIt.jl copied to clipboard
Automatic installation of Python modules via Conda.jl not working with special stacked environment configuration
In the module init, ENV["PYTHON"]="" is set, which should force to use the local Conda.jl environment. Then, a PyCall rebuild is forced when needed, because PyCall needs to be built as well with this environment variable set as explained in the PyCall documentation:
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia.
This PyCall rebuild forcing does not yet work in all cases.
This only did not work in a very special Julia set up with a stacked environment.
I ran into something like this when trying to install the package, but removal of Conda/PyCall.jl and their caches (~/.julia/conda) and subsequent re-installation fixed it for me.
Full logs
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.3 (2022-11-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> versioninfo()
Julia Version 1.8.3
Commit 0434deb161e (2022-11-14 20:14 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 1 on 8 virtual cores
(@v1.8) pkg> activate --temp
Activating new project at `/tmp/jl_5htjQo`
(jl_5htjQo) pkg> add JustSayIt
Updating registry at `~/.julia/registries/General.toml`
Resolving package versions...
Updating `/tmp/jl_5htjQo/Project.toml`
[d7252348] + JustSayIt v0.2.1
Updating `/tmp/jl_5htjQo/Manifest.toml`
[8f4d0f93] + Conda v1.7.0
[3f0dd361] + DefaultApplication v1.1.0
[682c06a0] + JSON v0.21.3
[d7252348] + JustSayIt v0.2.1
[1914dd2f] + MacroTools v0.5.10
[69de0a69] + Parsers v2.5.3
[21216c6a] + Preferences v1.3.0
[92933f4c] + ProgressMeter v1.7.2
[438e738f] + PyCall v1.95.1
[66db9d55] + SnoopPrecompile v1.0.3
[81def892] + VersionParsing v1.3.0
[0dad84c5] + ArgTools v1.1.1
[56f22d72] + Artifacts
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8ba89e20] + Distributed
[f43a241f] + Downloads v1.6.0
[7b1f6079] + FileWatching
[b77e0a4c] + InteractiveUtils
[b27032c2] + LibCURL v0.6.3
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[ca575930] + NetworkOptions v1.2.0
[44cfe95a] + Pkg v1.8.0
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA v0.7.0
[9e88b42a] + Serialization
[6462fe0b] + Sockets
[fa267f1f] + TOML v1.0.0
[a4e569a6] + Tar v1.10.1
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
[e66e0078] + CompilerSupportLibraries_jll v0.5.2+0
[deac9b47] + LibCURL_jll v7.84.0+0
[29816b5a] + LibSSH2_jll v1.10.2+0
[c8ffd9c3] + MbedTLS_jll v2.28.0+0
[14a3606d] + MozillaCACerts_jll v2022.2.1
[4536629a] + OpenBLAS_jll v0.3.20+0
[83775a58] + Zlib_jll v1.2.12+3
[8e850b90] + libblastrampoline_jll v5.1.1+0
[8e850ede] + nghttp2_jll v1.48.0+0
[3f19e933] + p7zip_jll v17.4.0+0
julia> using JustSayIt
[ Info: Running `conda config --set pip_interop_enabled true --file /home/pfitzseb/.julia/conda/3/condarc-julia.yml` in root environment
[ Info: Running `pip install pynput` in root environment
Collecting pynput
Using cached https://files.pythonhosted.org/packages/02/27/4de87850ff87c8dcecaaf8d27f28cec89ef17eeb6938f250449cb2635e06/pynput-1.7.6-py2.py3-none-any.whl
Requirement already satisfied: python-xlib>=0.17; "linux" in sys_platform in ./.julia/conda/3/lib/python3.7/site-packages (from pynput) (0.33)
Requirement already satisfied: six in ./.julia/conda/3/lib/python3.7/site-packages (from pynput) (1.12.0)
Collecting evdev>=1.3; "linux" in sys_platform (from pynput)
Using cached https://files.pythonhosted.org/packages/05/50/629b011a7f61cb2fca754ea8631575784bf8605a1ec4d6970a010bc54e2b/evdev-1.6.1.tar.gz
Building wheels for collected packages: evdev
Building wheel for evdev (setup.py) ... error
Complete output from command /home/pfitzseb/.julia/conda/3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-aqickqab/evdev/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-qm6l0gz_ --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.7/evdev
running build_ext
running build_ecodes
writing /tmp/pip-install-aqickqab/evdev/evdev/ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/evdev
gcc -pthread -B /home/pfitzseb/.julia/conda/3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/pfitzseb/.julia/conda/3/include/python3.7m -c evdev/input.c -o build/temp.linux-x86_64-3.7/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
gcc -pthread -shared -B /home/pfitzseb/.julia/conda/3/compiler_compat -L/home/pfitzseb/.julia/conda/3/lib -Wl,-rpath=/home/pfitzseb/.julia/conda/3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/evdev/input.o -o build/lib.linux-x86_64-3.7/evdev/_input.cpython-37m-x86_64-linux-gnu.so
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for evdev
Running setup.py clean for evdev
Failed to build evdev
Installing collected packages: evdev, pynput
Running setup.py install for evdev ... error
Complete output from command /home/pfitzseb/.julia/conda/3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-aqickqab/evdev/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-ci7vkixv/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.7/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.7/evdev
running build_ext
ecodes.c already exists ... skipping build_ecodes
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/evdev
gcc -pthread -B /home/pfitzseb/.julia/conda/3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/pfitzseb/.julia/conda/3/include/python3.7m -c evdev/input.c -o build/temp.linux-x86_64-3.7/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
gcc -pthread -shared -B /home/pfitzseb/.julia/conda/3/compiler_compat -L/home/pfitzseb/.julia/conda/3/lib -Wl,-rpath=/home/pfitzseb/.julia/conda/3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/evdev/input.o -o build/lib.linux-x86_64-3.7/evdev/_input.cpython-37m-x86_64-linux-gnu.so
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/home/pfitzseb/.julia/conda/3/compiler_compat/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_line
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/pfitzseb/.julia/conda/3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-aqickqab/evdev/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-ci7vkixv/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-aqickqab/evdev/
You are using pip version 19.0.3, however version 22.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: InitError: failed process: Process(setenv(`/home/pfitzseb/.julia/conda/3/bin/pip install pynput`,[<<REDACTED>>]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ ./process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:480
[3] run
@ ./process.jl:477 [inlined]
[4] pip(cmd::String, pkgs::String, env::String)
@ Conda ~/.julia/packages/Conda/x2UxR/src/Conda.jl:454
[5] pip
@ ~/.julia/packages/Conda/x2UxR/src/Conda.jl:450 [inlined]
[6] pyimport_pip(modulename::String; dependency::String, channel::String)
@ JustSayIt ~/.julia/packages/JustSayIt/IefnA/src/shared.jl:186
[7] pyimport_pip
@ ~/.julia/packages/JustSayIt/IefnA/src/shared.jl:180 [inlined]
[8] __init__()
@ JustSayIt.Keyboard ~/.julia/packages/JustSayIt/IefnA/src/Commands/Keyboard.jl:30
[9] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[10] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1039
[11] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[12] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[13] macro expansion
@ ./loading.jl:1180 [inlined]
[14] macro expansion
@ ./lock.jl:223 [inlined]
[15] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
during initialization of module Keyboard
caused by: PyError (PyImport_ImportModule
The Python package pynput could not be imported by pyimport. Usually this means
that you did not install pynput in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the pynput module, you can
use `pyimport_conda("pynput", PKG)`, where PKG is the Anaconda
package that contains the module pynput, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'pynput'")
Stacktrace:
[1] pyimport(name::String)
@ PyCall ~/.julia/packages/PyCall/twYvK/src/PyCall.jl:558
[2] pyimport_pip(modulename::String; dependency::String, channel::String)
@ JustSayIt ~/.julia/packages/JustSayIt/IefnA/src/shared.jl:182
[3] pyimport_pip
@ ~/.julia/packages/JustSayIt/IefnA/src/shared.jl:180 [inlined]
[4] __init__()
@ JustSayIt.Keyboard ~/.julia/packages/JustSayIt/IefnA/src/Commands/Keyboard.jl:30
[5] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1039
[7] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[8] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[9] macro expansion
@ ./loading.jl:1180 [inlined]
[10] macro expansion
@ ./lock.jl:223 [inlined]
[11] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144