8000 File not found error on Windows 10: setup script problem? · Issue #1 · algorecell/StableMotifs-python · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

File not found error on Windows 10: setup script problem? #1

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

Open
8000
jcrozum opened this issue Apr 16, 2021 · 2 comments
Open

File not found error on Windows 10: setup script problem? #1

jcrozum opened this issue Apr 16, 2021 · 2 comments

Comments

@jcrozum
Copy link
jcrozum commented Apr 16, 2021

I cannot get this to work; I get a FileNotFoundError. Here is an example.

PS C:\Users\jcroz\models> python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 16:30:00) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import stablemotifs
>>> sm = stablemotifs.load("test2.txt")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\stablemotifs\__init__.py", line 112, in load
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
>>> quit()
PS C:\Users\jcroz\models> cat test2.txt
xA*= xB
xB*= xA
xC*= xA or not xD
xD*= xC
xE*= xB and xF
xF*= xE

I installed via pip and the setup script output is

PS C:\Users\jcroz\AppData\Roaming> python -m stablemotifs_setup
# checking for stablemotifs
# installing colomoto/stablemotifs in C:\Users\jcroz\AppData\Roaming
downloading http://api.anaconda.org/download/colomoto/stablemotifs/1/noarch/stablemotifs-1-1.tar.bz2
installing C:\Users\jcroz\AppData\Roaming\opt/StableMotifs/README.TXT
installing C:\Users\jcroz\AppData\Roaming\opt/StableMotifs/lib/QuineMcCluskeyAlgorithm.jar
installing C:\Users\jcroz\AppData\Roaming\opt/StableMotifs/lib/FileClasses.jar
installing C:\Users\jcroz\AppData\Roaming\opt/StableMotifs/lib/JohnsonCycleAlgorithm.jar
installing C:\Users\jcroz\AppData\Roaming\opt/StableMotifs/StableMotifs.jar
installing C:\Users\jcroz\AppData\Roaming\opt/StableMotifs/lib/jgrapht-jdk1.6.jar
installing C:\Users\jcroz\AppData\Roaming\bin/StableMotifs

However, the supposedly installed files listed do not exist:

PS C:\Users\jcroz\AppData\Roaming> ls | grep opt
PS C:\Users\jcroz\AppData\Roaming> ls | grep bin
PS C:\Users\jcroz\AppData\Roaming> ls | grep StableMotifs
PS C:\Users\jcroz\AppData\Roaming>
@pauleve
Copy link
Member
pauleve commented Apr 21, 2021

Thanks for the report. Looks like a windows specific issue..
I've updated the helper script, can you try with it?
You need to install the git colomoto_jupyter beforehand:

pip install --user https://github.com/colomoto/colomoto-jupyter/archive/refs/heads/master.zip

and retry stablemotifs_setup (after git pull)

pauleve added a commit that referenced this issue Apr 21, 2021
@jcrozum
Copy link
Author
jcrozum commented Apr 29, 2021

Sorry for the slow reply. I have been doing some testing with Jorge to figure out what's going on with his Java version of stable motifs. I did try this again, and I get a different error now that I am pretty sure this has to do with deprecated Java functions in the stable motifs Java code and not anything with this Python interface. Here is the output:

Filename: SmallTest.txt
Creating Boolean table directory: SmallTest
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because "engine" is null
        at stablemotifs.OtherMethods.EvalStr(OtherMethods.java:235)
        at stablemotifs.ReadWriteFiles.createTablesFromBooleanRules(ReadWriteFiles.java:254)
        at stablemotifs.Main.main(Main.java:69)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\stablemotifs\__init__.py", line 122, in load
    return StableMotifsResult(wd, model_name, fixed)
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\stablemotifs\results.py", line 23, in __init__
    self.attractors = self._parse_attractors()
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\stablemotifs\results.py", line 30, in _parse_attractors
    df = pd.read_csv(inputf, sep='\t', index_col=-1) #index_col=-1 we cheat by making the extra tabs at the end of the rows in the files as the index column, and then resetting it to just natural incrementing integers
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pandas\io\parsers.py", line 676, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pandas\io\parsers.py", line 448, in _read
    parser = TextFileReader(fp_or_buf, **kwds)
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pandas\io\parsers.py", line 880, in __init__
    self._make_engine(self.engine)
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pandas\io\parsers.py", line 1114, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "C:\Users\jcroz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pandas\io\parsers.py", line 1891, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas\_libs\parsers.pyx", line 374, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas\_libs\parsers.pyx", line 674, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File C:\Users\jcroz\AppData\Local\Temp\StableMotifs-vcbxch1m\SmallTest-QuasiAttractors.txt does not exist: 'C:\\Users\\jcroz\\AppData\\Local\\Temp\\StableMotifs-vcbxch1m\\SmallTest-QuasiAttractors.txt'

I strongly suspect this is due to Java dropping Nashorn support in JRE/JDK 15. There is an update in the Java stable motifs readme about this: https://github.com/jgtz/StableMotifs. I've been able to work around this by changing the Python Java calls to point to an older JDK version, i.e.,

java_path = "<path to old Java version>\\bin\\java.exe"
jar_path = "<path to stable motifs Java directory>\\dist\\StableMotifs.jar"

def run_stable_motifs(filepath):
    wd = tempfile.mkdtemp(prefix="StableMotifs-")
    def cleanup():
        shutil.rmtree(wd)
    atexit.register(cleanup)

    shutil.copy(filepath, wd)
    base = os.path.basename(filepath)

    argv = [java_path,'-jar',jar_path, base]
    proc = subprocess.Popen(argv, cwd=wd,stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    result = proc.communicate()
   .
   .
   .

I got this to work with JDK 8 without warnings, but in principle, any version before 15 should work (potentially with lots of warnings about impending deprecation).

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

2 participants
0