neherlab / treetime

Maximum likelihood inference of time stamped phylogenies and ancestral reconstruction
MIT License
228 stars 56 forks source link

Cannot run `treetime` CLI command on Windows #196

Closed NiloofarVaghefi closed 2 years ago

NiloofarVaghefi commented 2 years ago

Hi there

I have installed treetime on windows 11 using: git clone https://github.com/neherlab/treetime.git cd treetime pip install .

I get the message: Successfully installed phylo-treetime-0.9.1

And I add the folder in my path, but still when I run treetime it cannot find the command. Even when I am in the treetime folder. just wondering if this is a known issue in Window 11?

Thanks Niloofar

corneliusroemer commented 2 years ago

Can you show the full command you are running and the error message?

And also the path (whatever that is in Windows...).

Do you use PowerShell?

To debug this I think we need more info. None of the developers use Windows but we can try our best to help.

On Wed, Jul 20, 2022, 01:46 NiloofarVaghefi @.***> wrote:

Hi there

I have installed treetime on windows 11 using: git clone https://github.com/neherlab/treetime.git cd treetime pip install .

I get the message: Successfully installed phylo-treetime-0.9.1

And I add the folder in my path, but still when I run treetime it cannot find the command. Even when I am in the treetime folder. just wondering if this is a known issue in Window 11?

Thanks Niloofar

— Reply to this email directly, view it on GitHub https://github.com/neherlab/treetime/issues/196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF77AQIKI5SKOBPRQ4OPNEDVU444JANCNFSM54BVPH4A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

NiloofarVaghefi commented 2 years ago

Hi there,

Thanks for your response.

I am trying to install treetime to be able to use Poutine.

1) I tried this in windows using command line:

C:\Users\vaghe>pip install phylo-treetime==0.8.6
Collecting phylo-treetime==0.8.6
  Downloading phylo_treetime-0.8.6-py3-none-any.whl (126 kB)
full log ```txt ---------------------------------------- 126.5/126.5 kB ? eta 0:00:00 Requirement already satisfied: matplotlib>=2.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (3.5.2) Requirement already satisfied: scipy>=0.16.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.8.1) Requirement already satisfied: numpy>=1.10.4 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.23.1) Requirement already satisfied: biopython!=1.77,!=1.78,>=1.67 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.79) Requirement already satisfied: pandas>=0.17.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.4.3) Requirement already satisfied: packaging>=20.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (21.3) Requirement already satisfied: pyparsing>=2.2.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (3.0.9) Requirement already satisfied: cycler>=0.10 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (4.34.4) Requirement already satisfied: pillow>=6.2.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (9.2.0) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (1.4.3) Requirement already satisfied: python-dateutil>=2.7 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (2.8.2) Requirement already satisfied: pytz>=2020.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from pandas>=0.17.1->phylo-treetime==0.8.6) (2022.1) Requirement already satisfied: six>=1.5 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.0->phylo-treetime==0.8.6) (1.16.0) Installing collected packages: phylo-treetime Attempting uninstall: phylo-treetime Found existing installation: phylo-treetime 0.9.1 Can't uninstall 'phylo-treetime'. No files were found to uninstall. ```
Successfully installed phylo-treetime-0.9.1

C:\Users\vaghe>treetime
'treetime' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\vaghe>cd treetime

C:\Users\vaghe\treetime>treetime
'treetime' is not recognized as an internal or external command,
operable program or batch file.

2) Then I tried it in Cornell’s BioHPC – They have installed Poutine, and the program starts running, but I then get a treetime error.

Starting poutine session: 2022-July-24 Sunday 06h:49m:48s GMT-4

Executing ancestral reconstruction . . . reconstruction complete.

An error has occurred while processing the nexus file in the ancestral reconstruction directory. Please see the stack trace in the log file for more information on this error.

I checked the log file. It looks like treetime cannot locate the nexus file. This is the output that treetime should make, right?

This is the command I run: ./poutine.sh -f /workdir/nv232/fasta.maf1.fasta -t /workdir/nv232/fasta.maf1.newick -p /workdir/nv232/230_test_ICC.txt -m /workdir/nv232/myplink.map --out-dir /workdir/nv232/test_out --force-overwrite --threads 8

Will you be able to help with any of these cases? I am desperately trying to get Poutine to work but it looks like I cannot get treetime to work with it.

NiloofarVaghefi commented 2 years ago

Hi there,

Thanks for your response.

I am trying to install treetime to be able to use Poutine.

  1. I tried this in windows using command line:

C:\Users\vaghe>pip install phylo-treetime==0.8.6 Collecting phylo-treetime==0.8.6 Downloading phylo_treetime-0.8.6-py3-none-any.whl (126 kB) ---------------------------------------- 126.5/126.5 kB ? eta 0:00:00 Requirement already satisfied: matplotlib>=2.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (3.5.2) Requirement already satisfied: scipy>=0.16.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.8.1) Requirement already satisfied: numpy>=1.10.4 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.23.1) Requirement already satisfied: biopython!=1.77,!=1.78,>=1.67 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.79) Requirement already satisfied: pandas>=0.17.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from phylo-treetime==0.8.6) (1.4.3) Requirement already satisfied: packaging>=20.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (21.3) Requirement already satisfied: pyparsing>=2.2.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (3.0.9) Requirement already satisfied: cycler>=0.10 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (4.34.4) Requirement already satisfied: pillow>=6.2.0 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (9.2.0) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (1.4.3) Requirement already satisfied: python-dateutil>=2.7 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->phylo-treetime==0.8.6) (2.8.2) Requirement already satisfied: pytz>=2020.1 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from pandas>=0.17.1->phylo-treetime==0.8.6) (2022.1) Requirement already satisfied: six>=1.5 in c:\users\vaghe\appdata\local\programs\python\python310\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.0->phylo-treetime==0.8.6) (1.16.0) Installing collected packages: phylo-treetime Attempting uninstall: phylo-treetime Found existing installation: phylo-treetime 0.9.1 Can't uninstall 'phylo-treetime'. No files were found to uninstall. Successfully installed phylo-treetime-0.9.1

C:\Users\vaghe>treetime 'treetime' is not recognized as an internal or external command, operable program or batch file.

C:\Users\vaghe>cd treetime

C:\Users\vaghe\treetime>treetime 'treetime' is not recognized as an internal or external command, operable program or batch file.

  1. Then I tried it in Cornell’s BioHPC – the program runs, but I get another treetime error.

Starting poutine session: 2022-July-24 Sunday 06h:49m:48s GMT-4

Executing ancestral reconstruction . . . reconstruction complete.

An error has occurred while processing the nexus file in the ancestral reconstruction directory. Please see the stack trace in the log file for more information on this error.

I checked the log file. It looks like treetime cannot locate a nexus file? This is an output that treetime should make, right?

This is the command I run:

./poutine.sh -f /workdir/nv232/fasta.maf1.fasta -t /workdir/nv232/fasta.maf1.newick -p /workdir/nv232/230_test_ICC.txt -m /workdir/nv232/myplink.map --out-dir /workdir/nv232/test_out --force-overwrite --threads 8

Will you be able to help with any of these cases? I am desperately trying to get Poutine to work but it looks like I cannot get treetime to work.

Thanks Niloofar From: Cornelius Roemer @.> Sent: Wednesday, 20 July 2022 8:30 PM To: neherlab/treetime @.> Cc: Niloofar Vaghefi @.>; Author @.> Subject: [EXT] Re: [neherlab/treetime] installation (Issue #196)

External email: Please exercise caution


Can you show the full command you are running and the error message?

And also the path (whatever that is in Windows...).

Do you use PowerShell?

To debug this I think we need more info. None of the developers use Windows but we can try our best to help.

On Wed, Jul 20, 2022, 01:46 NiloofarVaghefi @.<mailto:@.>> wrote:

Hi there

I have installed treetime on windows 11 using: git clone https://github.com/neherlab/treetime.git cd treetime pip install .

I get the message: Successfully installed phylo-treetime-0.9.1

And I add the folder in my path, but still when I run treetime it cannot find the command. Even when I am in the treetime folder. just wondering if this is a known issue in Window 11?

Thanks Niloofar

— Reply to this email directly, view it on GitHub https://github.com/neherlab/treetime/issues/196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF77AQIKI5SKOBPRQ4OPNEDVU444JANCNFSM54BVPH4A . You are receiving this because you are subscribed to this thread.Message ID: @.<mailto:@.>>

— Reply to this email directly, view it on GitHubhttps://github.com/neherlab/treetime/issues/196#issuecomment-1190106052, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO3RKKN6NTMEEKGBHOEHRUDVU7IKVANCNFSM54BVPH4A. You are receiving this because you authored the thread.Message ID: @.**@.>>

NiloofarVaghefi commented 2 years ago

Ok, the issue seems ot be half resolved I never figured out how to install this on Windows, but in Unix, it looksl ike the last version of treetime is not compatible with POUTINE, so they installed the previous version (0.8.6) and it is now working Thanks Niloofar

VaniseBio commented 2 years ago

Hi, Nillofar. I'm facing the same problem. It doesn't run on Windows 11. By the way, you didn't solve the problem with windows?

NiloofarVaghefi commented 2 years ago

Hi there. Unfortunately, I was not able to solve the problem with windows. I ended up using it on a HPC.

corneliusroemer commented 2 years ago

@VaniseBio and @NiloofarVaghefi I'm still not quite sure how exactly you're trying to install and run treetime.

Could you please add the following infos to make it reproducible for the team:

It looks like the problem is not so much installing the package but running the standalone treetime command. Can you test the following short script, or run the command in the Python REPL?

import treetime

It could well be that using treetime does not work on windows. In that case we should update the documentation.

Does this

victorlin commented 2 years ago

I have access to a Windows 10 machine and can reproduce this. import treetime in the Python REPL works fine. This issue is with the treetime command on Windows.

First, I did this all under a new conda environment and installed augur + nextstrain, two other Python CLIs maintained by the Nextstrain team.

mamba create -n test37 python=3.7 --yes
pip install phylo-treetime==0.8.6 nextstrain-augur nextstrain-cli

Then, I noted that treetime does not work as described in this issue, while augur and nextstrain commands work fine. Let's compare:

(test37) C:\Users\vlin>where augur
C:\Users\vlin\Miniconda3\envs\test37\Scripts\augur.exe

(test37) C:\Users\vlin>where nextstrain
C:\Users\vlin\Miniconda3\envs\test37\Scripts\nextstrain.exe

(test37) C:\Users\vlin>where treetime
C:\Users\vlin\Miniconda3\envs\test37\Scripts\treetime

So, Augur and Nextstrain CLI are available as Windows executables while treetime is a text file with a shebang being an absolute path to python.exe. While treetime is in the path, neither CMD prompt nor PowerShell prompt seem to know how to run this file properly.

victorlin commented 2 years ago

The solution is probably to generate a treetime.exe with the build. I'm not sure how exactly it's done for Augur and Nextstrain CLI but can dig into it. @corneliusroemer @rneher what's the current release process for TreeTime?

corneliusroemer commented 2 years ago

Thanks for investigating @victorlin, much appreciated!

I'm not super closely involved with treetime dev work. Let's see what Richard says.

A workaround for now could be to replace treetime with python PATH_TO_TREETIME_FOLDER\bin\treetime. Do you know if the path can be left out of this somehow?

corneliusroemer commented 2 years ago

@victorlin could the difference be that treetime uses the following line in setup.py:

        scripts=['bin/treetime']

while augur has this instead?

entry_points = {
        "console_scripts": [
            "augur = augur.__main__:main",
        ]
    }

It could be that the second gets turned into an .exe but the former doesn't. So could be as simple as changing that line in setup.py!

Can you maybe test that?

corneliusroemer commented 2 years ago

Ah, I think that's it!

See SO: https://stackoverflow.com/a/28119736/7483211

And the relevant part of the Python docs: https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/?highlight=scripts#scripts

Although setup() supports a scripts keyword for pointing to pre-made scripts to install, the recommended approach to achieve cross-platform compatibility is to use console_scripts entry points (see below).