-
Notifications
You must be signed in to change notification settings - Fork 253
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
conan.cmake fails when using pyenv #308
Comments
Hi @BlueSolei, |
Has this issue been fixed? I still face it with v0.16.1. |
I opened this issue, but after using Conan for a while, I understood that the right way to go about here is to use python's virtual environment. |
Thanks for the reply, I'm trying to run it over msys2, starting python's virtual env didn't help. |
Do you mean |
that worked, thanks a lot! |
This is not always correct since you can create a virtualenv with activated pyenv-shell. That way you can also guarantee which python version will be used for virtualenv. Virtualenv just isolates python packages, not python versions. So using this snippet will also cause problems:
|
venv does have its own python.exe |
Ok, sure does it have it's own python.exe, but either I messed up with PATH variable on windows, which in fact is needed to be prepend
So it does not compile in this case for me since meson build is not looking up python.exe in virtualenv apparently. |
I don't know why Conan is looking for After activating the venv (
Shows that it looking for |
I'm using either cmd.exe on windows 10 or powershell version 7.2 |
isolating in a venv worked for me, because when you install conan, it goes into scripts/conan.exe, and that shows up first in the path
shims show up after venv:
|
Just bumping on this issue again as it doesn't seemed to be fixed for me yet. We're using Windows 10, and it's still looking for python3 in the build process even though it was started from the command line with activated venv The log file from the failing build job looks like this:
Running it again yields to:
|
I use this to find the "real" conan when it's actually a shell script with pyenv, in case this is useful to anyone: function(set_conan_cmd)
if (DEFINED CONAN_CMD)
return()
endif()
set(in_conan_cmd ${ARGN})
# If in_conan_cmd is empty, use "conan"
if ((NOT DEFINED in_conan_cmd) OR (${in_conan_cmd} EQUAL ""))
set(in_conan_cmd conan)
endif()
# If in_conan_cmd is not an absolute path, find it
if (NOT (${in_conan_cmd} MATCHES "^/" OR ${in_conan_cmd} MATCHES "^[a-zA-Z]:/"))
find_program(in_conan_cmd ${in_conan_cmd})
endif()
# On Windows, check for pyenv script and find the real binary
if (WIN32 AND ${in_conan_cmd} MATCHES ".*pyenv")
find_program(pyenv_cmd pyenv)
execute_process(COMMAND "c:/bin/bash" ${pyenv_cmd} which conan
OUTPUT_VARIABLE conan_path
OUTPUT_STRIP_TRAILING_WHITESPACE)
file(TO_CMAKE_PATH ${conan_path} conan_path) # normalize backslashes to forward
set(CONAN_CMD ${conan_path} PARENT_SCOPE)
message(STATUS "Found pyenv conan (Win32) at ${conan_path}")
else()
file(TO_CMAKE_PATH ${in_conan_cmd} in_conan_cmd)
set(CONAN_CMD ${in_conan_cmd} PARENT_SCOPE)
endif()
endfunction() |
Issue
Hi,
The conan.cmake script fails due to the
conan
command is not an executable.I use PyEnv on windows, so my
conan
command is a .bat file, or if running in Git-Bash, its a sh script.The error I get is
Conan install failed='%1 is not a valid Win32 application
Here is the cmake run:
A fix
I manage to fix the issue by running the calls to
conan
in a shell, like this:I am quite a novice in CMake, so I don't know what will be the right way to fix this.
The text was updated successfully, but these errors were encountered: