Creating virtual environment failed: Exiting because of an error: exit status 1

Hello,

When I try to create a virtual environment I got an error because of an exit code like this:
PS C:\DevOps\Python.ParametricDesign\RWZITank> viktor-cli.exe install
SDK version: 12.9.0 Connector version: 5.10.0
Creating app specific install dir viktor-docs
Creating app specific install dir viktor-stubs
Creating app specific install dir signals
Creating virtual environment
Error: Command ā€˜[ā€˜C:\DevOps\Python.ParametricDesign\RWZITank\venv\Scripts\python.exeā€™, ā€˜-Imā€™, ā€˜ensurepipā€™, ā€˜ā€“upgradeā€™, ā€˜ā€“default-pipā€™]ā€™ returned non-zero exit status 1.
Exiting because of an error: exit status 1

But I have no idea what is going on.

Hope to hear from you soon!
Sjoerd

Hi Sjoerd,

Letā€™s check which Python your system uses, could you open a cmd terminal and give me the output of:

where python

Hi Kevin,

The results are:
C:\Users\hsc>where python
C:\Users\hsc\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\python.exe
C:\Users\hsc\AppData\Local\Microsoft\WindowsApps\python.exe

So it creates a python env based on an already installed python version? I also have miniconda installed, can I refer to this instead maybe? I donā€™t know if it is the ArcGIS Pro version or the windows version that is causing troubles

Thatā€™s right, the viktor-cli picks the first Python from that list. In your case, Python comes with conda / arcgis it seems. I would advise to install a regular Python version, here you can download the Windows x86-64 executable installer.

When installed, please make sure that this Python version is listed first in the Path environnment variable. In your Windows search box you can type ā€œenvironment variablesā€ and click on ā€œEdit the system environment variablesā€. In the popup windows, click on ā€œEnvironment Variablesā€¦ā€, select ā€œPathā€ and click ā€œEditā€¦ā€. Then you need to select the line with the new python installation and ā€œMove Upā€ to the top. Make sure both the ā€œā€¦\Python37ā€ as well as ā€œā€¦\Python37\Scriptsā€ is moved to the top:

Hi Kevin,

It seems to have worked. Is the reason to use this python installer that in there the already needed python packages are available? Because I think in miniconda the default installed python packages are very limited. Is this why?
Thanks for the help!

Greetings,
Sjoerd

Hi Sjoerd,

The CLI uses the Python interpreter that is found first in the PATH variable. In your case this interpreter is the one that came with ArcGIS. I can imagine that this is a non-standard version of Python to be able to work with ArcGIS. Miniconda is a Python distribution by a third-party, Anaconda, that uses Conda as a package management system. Although using this with the CLI might work, we do not actively support using Python that comes with the Anaconda/Miniconda distribution.

VIKTOR just uses plain Python and pip (the preferred package installer for Python). If you use viktor-cli install a virtual environment is created with all the packages you defined in requirements.txt by doing a pip install. You do not need to activate this environment yourself, this is handled by the CLI