I am trying to set up the covarep software on my win64 machine for a project and need to install 'a Windows 32-bit version of Python 2.7, 3.3, and/or 3.4'.
I used conda (platform win-64) to run conda create -n "covarep-env" python=3.4.0 -c free
This created an environment that has python version 3.4.0, but this obviously defaults to installing the win-64 version.
After following the covarep README instructions and running import covarep_py
in python, I get the error
RuntimeError: To call deployed MATLAB code on a win32 machine, you must run a win32 version of Python. Details: C:\Program Files (x86)\MATLAB\MATLAB Runtime\v90\runtime\win32
Q: Is there a way to specify the win32 platform version of python when running conda create
?
CodePudding user response:
You must set the CONDA_FORCE_32BIT environment variable (got it from [YouTube]: DotPi - Create 32-bit Python Environments from a 64-bit Conda Installation) before creating the environment (not related to (previous) "environment variable").
Unfortunately the only official reference I could find is [Anaconda.Docs]: Troubleshooting - Using 32- and 64-bit libraries and CONDA_FORCE_32BIT.
Example (Anaconda Prompt - I used Python 3.6 as an example, as I need it for another task):
(base) [cfati@CFATI-5510-0:C:\Users\cfati]> :: Create a "regular" (pc064) environment (base) [cfati@CFATI-5510-0:C:\Users\cfati]> conda create -n py_pc064_03_06_02 python=3.6.2 Collecting package metadata (current_repodata.json): done Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.14.0 latest version: 22.9.0 Please update conda by running $ conda update -n base -c defaults conda ## Package Plan ## environment location: f:\Install\pc064\Anaconda\Anaconda\Version\envs\py_pc064_03_06_02 added / updated specs: - python=3.6.2 The following NEW packages will be INSTALLED: certifi pkgs/main/win-64::certifi-2021.5.30-py36haa95532_0 pip pkgs/main/win-64::pip-21.2.2-py36haa95532_0 python pkgs/main/win-64::python-3.6.2-h09676a0_15 setuptools pkgs/main/win-64::setuptools-58.0.4-py36haa95532_0 vc pkgs/main/win-64::vc-14.2-h21ff451_1 vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2 wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 wincertstore pkgs/main/win-64::wincertstore-0.2-py36h7fe50ca_0 Proceed ([y]/n)? y Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate py_pc064_03_06_02 # # To deactivate an active environment, use # # $ conda deactivate Retrieving notices: ...working... done (base) [cfati@CFATI-5510-0:C:\Users\cfati]> (base) [cfati@CFATI-5510-0:C:\Users\cfati]> :: SET ENVIRONMENT VARIABLE (base) [cfati@CFATI-5510-0:C:\Users\cfati]> set CONDA_FORCE_32BIT=1 (base) [cfati@CFATI-5510-0:C:\Users\cfati]> :: Create a funky (pc032) environment (base) [cfati@CFATI-5510-0:C:\Users\cfati]> conda create -n py_pc032_03_06_02 python=3.6.2 Collecting package metadata (current_repodata.json): done Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: done ## Package Plan ## environment location: f:\Install\pc064\Anaconda\Anaconda\Version\envs\py_pc032_03_06_02 added / updated specs: - python=3.6.2 The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2021.5.30 | py36h9f7ea03_0 140 KB pip-21.2.2 | py36h9f7ea03_0 1.8 MB python-3.6.2 | hb0ff576_15 12.8 MB setuptools-58.0.4 | py36h9f7ea03_0 777 KB vc-14.2 | h21ff451_1 8 KB vs2015_runtime-14.27.29016 | h5e58377_2 1000 KB wheel-0.37.1 | pyhd3eb1b0_0 33 KB wincertstore-0.2 | py36hcdd9a18_0 14 KB ------------------------------------------------------------ Total: 16.5 MB The following NEW packages will be INSTALLED: certifi pkgs/main/win-32::certifi-2021.5.30-py36h9f7ea03_0 pip pkgs/main/win-32::pip-21.2.2-py36h9f7ea03_0 python pkgs/main/win-32::python-3.6.2-hb0ff576_15 setuptools pkgs/main/win-32::setuptools-58.0.4-py36h9f7ea03_0 vc pkgs/main/win-32::vc-14.2-h21ff451_1 vs2015_runtime pkgs/main/win-32::vs2015_runtime-14.27.29016-h5e58377_2 wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 wincertstore pkgs/main/win-32::wincertstore-0.2-py36hcdd9a18_0 Proceed ([y]/n)? y Downloading and Extracting Packages vc-14.2 | 8 KB | ############################################################################ | 100% vs2015_runtime-14.27 | 1000 KB | ############################################################################ | 100% certifi-2021.5.30 | 140 KB | ############################################################################ | 100% setuptools-58.0.4 | 777 KB | ############################################################################ | 100% wincertstore-0.2 | 14 KB | ############################################################################ | 100% pip-21.2.2 | 1.8 MB | ############################################################################ | 100% python-3.6.2 | 12.8 MB | ############################################################################ | 100% wheel-0.37.1 | 33 KB | ############################################################################ | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate py_pc032_03_06_02 # # To deactivate an active environment, use # # $ conda deactivate Retrieving notices: ...working... done (base) [cfati@CFATI-5510-0:C:\Users\cfati]> :: RESET ENVIRONMENT VARIABLE (to avoid any future problems in this terminal) (base) [cfati@CFATI-5510-0:C:\Users\cfati]> set CONDA_FORCE_32BIT= (base) [cfati@CFATI-5510-0:C:\Users\cfati]> conda env list # conda environments: # F:\Install\pc032\Intel\OneAPI\Version\intelpython\python3.7 F:\Install\pc032\Intel\OneAPI\Version\intelpython\python3.7\envs\2021.1.1 base * f:\Install\pc064\Anaconda\Anaconda\Version py_pc032_03_06_02 f:\Install\pc064\Anaconda\Anaconda\Version\envs\py_pc032_03_06_02 py_pc064_03_06_02 f:\Install\pc064\Anaconda\Anaconda\Version\envs\py_pc064_03_06_02 py_pc064_03_08_08 f:\Install\pc064\Anaconda\Anaconda\Version\envs\py_pc064_03_08_08 py_pc064_03_10_00 f:\Install\pc064\Anaconda\Anaconda\Version\envs\py_pc064_03_10_00
Verify the created environments (check [SO]: How do I determine if my python shell is executing in 32bit or 64bit mode on OS X? (@CristiFati's answer) for more details):
(base) [cfati@CFATI-5510-0:C:\Users\cfati]> :: Activate pc064 env (base) [cfati@CFATI-5510-0:C:\Users\cfati]> conda activate py_pc064_03_06_02 (py_pc064_03_06_02) [cfati@CFATI-5510-0:C:\Users\cfati]> python Python 3.6.2 |Anaconda, Inc.| (default, Sep 30 2017, 11:52:29) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes as ct >>> print(ct.sizeof(ct.c_void_p) * 8) 64 >>> ^Z (py_pc064_03_06_02) [cfati@CFATI-5510-0:C:\Users\cfati]> conda deactivate (base) [cfati@CFATI-5510-0:C:\Users\cfati]> :: Activate pc032 env (base) [cfati@CFATI-5510-0:C:\Users\cfati]> conda activate py_pc032_03_06_02 (py_pc032_03_06_02) [cfati@CFATI-5510-0:C:\Users\cfati]> python Python 3.6.2 |Anaconda, Inc.| (default, Sep 30 2017, 11:44:55) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes as ct >>> print(ct.sizeof(ct.c_void_p) * 8) 32 >>> ^Z (py_pc032_03_06_02) [cfati@CFATI-5510-0:C:\Users\cfati]> conda deactivate (base) [cfati@CFATI-5510-0:C:\Users\cfati]>