Skip to content
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

Setting hole as an executable when running through Conda in Windows #57

Open
Kuroiii-i opened this issue Apr 5, 2024 · 0 comments
Open

Comments

@Kuroiii-i
Copy link

I have created a virtual environment mdahole2 within Conda on Windows following the directions in this GitHub, where it is running on the 2017 Virtual Studio compiler. Since hole2 is supposed to be downloaded alongside mdahole2 I found out that the hole2 folder present within site-packages within the virtual environment does not have the hole executable along with the other scripts that are present if I were to extract it within Ubuntu. So, I unzipped 64-bit Ubuntu version of 'hole2' from the website using Ubuntu, verified that it gives the output as it should when running in Ubuntu

~\hole2\exe\hole

and copied the folder from the virtual machine into my Windows system and manually specified the path to that folder within the python script below. I have been using the Spyder as the python interface. I attempted to run the following script in Spyder after calling it within the virtual environment mdahole2:

import MDAnalysis as mda
from mdahole2.analysis import HoleAnalysis
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

import warnings
# suppress some MDAnalysis warnings when writing PDB files
warnings.filterwarnings('ignore')

path1_pos = 'D:/.../complex-md-fixed.pdb'
path1_traj = 'D:/.../complex-md_centered.xtc'
u1 = mda.Universe(path1_pos,path1_traj)

path4 = 'C:/.../hole2/exe/hole'
ha = HoleAnalysis(u1, select='name BB',
                        cpoint='center_of_geometry',
                        executable=path4))
ha.run()

which gives an output of the following

Traceback (most recent call last):

  Cell In[3], line 20
    ha.run()

  File ~\anaconda3\envs\mdahole2\Lib\site-packages\mdahole2\analysis\hole.py:576 in run
    return super(HoleAnalysis, self).run(start=start, stop=stop,

  File ~\anaconda3\envs\mdahole2\Lib\site-packages\MDAnalysis\analysis\base.py:448 in run
    self._single_frame()

  File ~\anaconda3\envs\mdahole2\Lib\site-packages\mdahole2\analysis\hole.py:674 in _single_frame
    run_hole(outfile=outfile, infile_text=infile_text,

  File ~\anaconda3\envs\mdahole2\Lib\site-packages\mdahole2\analysis\utils.py:386 in run_hole
    proc = subprocess.Popen(executable, stdin=subprocess.PIPE,

  File ~\anaconda3\envs\mdahole2\Lib\site-packages\spyder_kernels\customize\spydercustomize.py:109 in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File ~\anaconda3\envs\mdahole2\Lib\subprocess.py:1026 in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File ~\anaconda3\envs\mdahole2\Lib\subprocess.py:1538 in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

OSError: [WinError 193] %1 is not a valid Win32 application

The problem I suspect is that it running a Unix-based executable on Windows, which gives it that error. I tried to import subprocess to try to run the Unix based executable

import subprocess
# nothing changed from previous code
ha = HoleAnalysis(u1, select='name BB',
                        cpoint='center_of_geometry',
                        executable=subprocess.run(path4, shell=True) )
ha.run()

which gave the following output:

Traceback (most recent call last):

  Cell In[4], line 24
    ha = HoleAnalysis(u1, select='name BB',

  File ~\anaconda3\envs\mdahole2\Lib\site-packages\mdahole2\analysis\hole.py:502 in __init__
    hole = shutil.which(executable)

  File ~\anaconda3\envs\mdahole2\Lib\shutil.py:1493 in which
    if os.path.dirname(cmd):

  File <frozen ntpath>:251 in dirname

  File <frozen ntpath>:213 in split

TypeError: expected str, bytes or os.PathLike object, not CompletedProcess

At this point, I am bit unsure of what to do, I would like to see if anyone here has had experience running mdahole2 within a Conda environment on a Windows workstation and see if there is a solution to this problem. I understand mdahole2 is designed for Linux-based systems, but I want to troubleshoot this issue since I think I am close to potentially running it on Windows. This could help others that may wanting to use it in Windows, so any help is appreciated. Let me know if more information is needed.

Miscellaneous

Since earlier attempts to download mdahole2 did not recognize the 2017 version of vcvarsall.bat, I manually download the 2017 version of Virtual Studio. Within the 'mdahole2' virtual environment on Conda, I ran the following:

conda install anaconda::vs2017_win-64

which gave an output of

Windows SDK version found as: "10.0.17763.0"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.60
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64

The hole2 download is also in the 64 bit format, so I am unsure if this had to do anything with the problem. The current version of Python that I have is Python 3.11.8. My Anaconda version is: conda 23.7.4 . Here is information on the device I am on:

Processor Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz 2.90 GHz
Installed RAM 64.0 GB (63.7 GB usable)
System type 64-bit operating system, x64-based processor
Edition Windows 10 Pro
Version 22H2
Installed on ‎1/‎26/‎2022
OS build 19045.4170
Experience Windows Feature Experience Pack 1000.19054.1000.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant