Conda build fails to set some build environment variables during the build process.
During build I get the following error message
%SRC_DIR%>et "CONDA_BUILD=1"
'et' is not recognized as an internal or external command,
operable program or batch file.
Inspecting the build_env_setup.bat (temporary file in build work folder) it is suppose to set "CONDA_BUILD=1".
That is, it has somehow lost the s from set. This happens for roughly half of the set calls in the build_env_setup.bat.
I have tried building on another Windows machine and (using the equivalent build.sh) on Debian (wsl) and it works. So it seems to be an error on my machine. Uninstall + install Miniconda did nothing.
What can cause this error and how may I resolve it?
Update / Extra Info
- This behavior is observed using PowerShell 7.1.3. When using CMD all the variables are set.
- The generated
build_env_setup.bathas Unix style line-endings (LF) changing to CRLF make thebuild_env_setup.batscript work. - There is a Ø in one of the paths set (on my system) removing that line also makes the (remaining)
build_env_setup.batscript work.
Conclusion seems to be that there is some string encoding / reading mismatch when running the various build scrips using PowerShell in the (edge?) cases with special characters in paths.
Old formulation
I am attempting to build a conda package from a standard src-layout python library but my builds keeps failing when using a Windows build script bld.bat with the error message:
'(_h_env)%SRC_DIR%>"" setup.py install
'""' is not recognized as an internal or external command,
operable program or batch file.
This seems to indicate that the %PYTHON% environment variable is not defined. (Which I was assuming to exist based on Environment variables and Writing the build script files)
If I add a build section to the meta.yaml:
build:
noarch: python
script: "{{ PYTHON }} setup.py install"
Then the build works.
What is the reason for this behavior and where is the error when using the build script?
Setup
- OS: Windows 10
- conda: 4.13.0
- conda-build: 3.21.9
- python: 3.10.4
Folders and files
│ setup.py
│
├───conda_recipe
│ bld.bat
│ meta.yaml
│
└───src
└───conda_build_test
module.py
__init__.py
bld.bat
"%PYTHON%" setup.py install
if errorlevel 1 exit 1
meta.yaml
package:
name: conda_build_test
version: {{ data.get('version') }}
source:
path: ..
requirements:
build:
- python
- setuptools
run:
- python