Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

conda environments create - No Module Named 'win32api'

Gurunath_d_
Beginner
3,500 Views

Hi, 

I am using Intel distribution of python. When I run the command in cmd 'conda create --name testEnv --clone root', I get ImportError: No Module named 'win32api' 

The error stackTrace and conda info are as below:

StackTrace:

menuinst Exception:Traceback (most recent call last):
  File "C:\IntelPython3\lib\site-packages\conda\gateways\disk\create.py", line 150, in make_menu
    menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix)
  File "C:\IntelPython3\lib\site-packages\menuinst\__init__.py", line 57, in install
    "import menuinst; menuinst.install(%r, %r, %r)" % (path, bool(remove), prefix)])
  File "C:\IntelPython3\lib\site-packages\menuinst\win_elevate.py", line 41, in runAsAdmin
    import win32api, win32con, win32event, win32process
ImportError: No module named 'win32api'
menuinst Exception:Traceback (most recent call last):
  File "C:\IntelPython3\lib\site-packages\conda\gateways\disk\create.py", line 150, in make_menu
    menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix)
  File "C:\IntelPython3\lib\site-packages\menuinst\__init__.py", line 57, in install
    "import menuinst; menuinst.install(%r, %r, %r)" % (path, bool(remove), prefix)])
  File "C:\IntelPython3\lib\site-packages\menuinst\win_elevate.py", line 41, in runAsAdmin
    import win32api, win32con, win32event, win32process
ImportError: No module named 'win32api'

CONDA INFO

Current conda install:

               platform : win-64
          conda version : 4.3.22
       conda is private : False
      conda-env version : 4.3.22
    conda-build version : not installed
         python version : 3.5.3.final.0
       requests version : 2.13.0
       root environment : C:\IntelPython3  (writable)
    default environment : C:\IntelPython3
       envs directories : C:\IntelPython3\envs
                          C:\Users\Xuser\AppData\Local\conda\conda\envs
                          C:\Users\Xuser\.conda\envs
          package cache : C:\IntelPython3\pkgs
                          C:\Users\Xuser\AppData\Local\conda\conda\pkgs
           channel URLs : https://conda.anaconda.org/intel/win-64
                          https://conda.anaconda.org/intel/noarch
                          https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/win-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/win-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://repo.continuum.io/pkgs/msys2/win-64
                          https://repo.continuum.io/pkgs/msys2/noarch
            config file : C:\IntelPython3\.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.22 requests/2.13.0 CPython/3.5.3 Windows/10 Windows/10.0.14393
          administrator : False

0 Kudos
4 Replies
Rohit_J_Intel
Employee
3,500 Views

Hi Gurunath,

Before creating your conda env, can you run the following : 

conda install pywin32

After conda installs the package, you can try cloning the root environment and hopefully that should workout

Thanks,
Rohit

Gurunath_d_
Beginner
3,500 Views

Thanks Rohit. I did that and when i enter the same command  'conda create --name testEnv --clone root'  in cmd. I get an error alert box with heading/title - pythonw and message -  Windows cannot find 'pythonw' Make sure you typed the name correctly, and then try again. The exception is from menuinst Exception. 

 

 

0 Kudos
Gurunath_d_
Beginner
3,500 Views

Hi Rohit, 

PYTHONHOME AND PYTHONPATH are unset in cmd. 

The output of conda list is as follows:

# packages in environment at C:\IntelPython3:
#
asn1crypto                0.22.0                   py35_0  
backports                 1.0                py35_intel_6  [intel]  intel
bleach                    1.5.0              py35_intel_0  [intel]  intel
bzip2                     1.0.6              vc14_intel_9  [vc14 intel]  intel
cffi                      1.9.1              py35_intel_1  [intel]  intel
colorama                  0.3.7              py35_intel_5  [intel]  intel
conda                     4.3.25                   py35_0  
conda-env                 2.6.0                         0  
cryptography              1.8.1                    py35_0  
cycler                    0.10.0             py35_intel_5  [intel]  intel
cython                    0.25.2             py35_intel_4  [intel]  intel
decorator                 4.0.11             py35_intel_0  [intel]  intel
distarray                 0.6.0              py35_intel_4  [intel]  intel
entrypoints               0.2.2              py35_intel_2  [intel]  intel
freetds                   1.00.9                   vc14_0  [vc14]
get_terminal_size         1.0.0              py35_intel_5  [intel]  intel
hdf5                      1.8.17             vc14_intel_8  [vc14 intel]  intel
html5lib                  0.999              py35_intel_0  [intel]  intel
icc_rt                    16.0.3                  intel_6  [intel]  intel
idna                      2.6                      py35_0  
impi_rt                   2017.0.3                intel_9  [intel]  intel
intelpython               2017.0.3                      4    intel
ipykernel                 4.5.0              py35_intel_9  [intel]  intel
ipyparallel               6.0.2              py35_intel_0  [intel]  intel
ipython                   5.3.0              py35_intel_0  [intel]  intel
ipython_genutils          0.2.0              py35_intel_0  [intel]  intel
ipywidgets                6.0.0              py35_intel_0  [intel]  intel
jinja2                    2.9.5              py35_intel_3  [intel]  intel
jsonschema                2.5.1              py35_intel_5  [intel]  intel
jupyter                   1.0.0              py35_intel_5  [intel]  intel
jupyter_client            5.0.0              py35_intel_1  [intel]  intel
jupyter_console           5.1.0              py35_intel_0  [intel]  intel
jupyter_core              4.3.0              py35_intel_0  [intel]  intel
libpng                    1.6.28            vc14_intel_10  [vc14 intel]  intel
llvmlite                  0.17.0             py35_intel_2  [intel]  intel
markupsafe                0.23               py35_intel_6  [intel]  intel
matplotlib                2.0.0              py35_intel_0  [intel]  intel
menuinst                  1.4.1              py35_intel_4  [intel]  intel
mistune                   0.7.4              py35_intel_0  [intel]  intel
mkl                       2017.0.3                intel_6  [intel]  intel
mpi4py                    2.0.0             py35_intel_14  [intel]  intel
mpmath                    0.19               py35_intel_5  [intel]  intel
nbconvert                 5.1.1              py35_intel_0  [intel]  intel
nbformat                  4.3.0              py35_intel_0  [intel]  intel
nose                      1.3.7             py35_intel_12  [intel]  intel
notebook                  5.0.0              py35_intel_0  [intel]  intel
numba                     0.32.0            py35_intel_14  [intel]  intel
numexpr                   2.6.2           np112py35_intel_1  [intel]  intel
numpy                     1.12.1             py35_intel_8  [intel]  intel
openmp                    2017.0.3                intel_8    intel
openssl                   1.0.2j             vc14_intel_3  [vc14 intel]  intel
packaging                 16.8                     py35_0  
pandas                    0.20.1          np112py35_intel_1  [intel]  intel
pandocfilters             1.4.1              py35_intel_0  [intel]  intel
path.py                   10.1               py35_intel_0  [intel]  intel
pickleshare               0.7.4              py35_intel_1  [intel]  intel
pip                       9.0.1              py35_intel_0  [intel]  intel
prompt_toolkit            1.0.14             py35_intel_0  [intel]  intel
pyasn1                    0.2.3                    py35_0  
pycosat                   0.6.2              py35_intel_1  [intel]  intel
pycparser                 2.17               py35_intel_0  [intel]  intel
pydaal                    2017.0.3.20170414 np112py35_intel_3  [intel]  intel
pygments                  2.2.0              py35_intel_0  [intel]  intel
pymssql                   2.1.3                    py35_0  
pyopenssl                 17.0.0                   py35_0  
pyparsing                 2.1.4              py35_intel_5  [intel]  intel
pypiwin32                 219                       <pip>
pytables                  3.3.0           np112py35_intel_2  [intel]  intel
python                    3.5.4                         0  
python-dateutil           2.6.0              py35_intel_0  [intel]  intel
pytz                      2017.2             py35_intel_0  [intel]  intel
pywin32                   220                      py35_2  
pyyaml                    3.12               py35_intel_1  [intel]  intel
pyzmq                     16.0.2             py35_intel_2  [intel]  intel
requests                  2.13.0             py35_intel_0  [intel]  intel
ruamel_yaml               0.11.14            py35_intel_1  [intel]  intel
scikit-learn              0.18.1             py35_intel_6  [intel]  intel
scipy                     0.19.0          np112py35_intel_2  [intel]  intel
setuptools                27.2.0             py35_intel_0  [intel]  intel
simplegeneric             0.8.1              py35_intel_5  [intel]  intel
six                       1.10.0             py35_intel_7  [intel]  intel
sqlite                    3.13.0                 intel_14  [vc14 intel]  intel
sympy                     1.0                py35_intel_5  [intel]  intel
tbb                       2017.0.7           py35_intel_2  [intel]  intel
tcl                       8.6.4              vc14_intel_3  [vc14 intel]  intel
testpath                  0.3                py35_intel_0  [intel]  intel
tk                        8.6.4             vc14_intel_14  [vc14 intel]  intel
tornado                   4.4.2              py35_intel_0  [intel]  intel
traitlets                 4.3.2              py35_intel_0  [intel]  intel
vc                        14                            0  
vs2015_runtime            14.0.25123              intel_3  [intel]  intel
wcwidth                   0.1.7              py35_intel_5  [intel]  intel
wheel                     0.29.0             py35_intel_5  [intel]  intel
widgetsnbextension        2.0.0                    py35_0    intel
win_unicode_console       0.5                py35_intel_0  [intel]  intel
xz                        5.2.2             vc14_intel_15  [vc14 intel]  intel
zlib                      1.2.11             vc14_intel_2  [vc14 intel]  intel

Thanks. 

0 Kudos
Rohit_J_Intel
Employee
3,500 Views

Hi Gurunath,

I looked a little more into this problem. Without pywin32 installed in root environment, if one tries to create a clone of the root environment while running cmd as an Administrator, a certain code-path is executed in menuinst which invokes calls to pywin32. There are two things though :

  1. If pywin32 is not present in the root environment, the clone of conda-env is still created despite the ImportError cropping up - you can run .\IDP_installation\Scripts\activate testEnv and it would create a functional conda-env 
  2. If pywin32 is installed into the root environment before the clone is created, at the time of creation of cloned conda-env, the user would have to approve the attached prompt being shown to user (this is the additional functionality that is exercised by menuinst in presence of pywin32). So, if your root environment has pywin32 installed, and then you try to create a clone of conda-env, you'd have to select "Yes" for the prompts shown, else the cloned conda-env would not be created.

Thanks,
Rohit

screenshot_prompt.PNG

0 Kudos
Reply