knaidoo29 / mistree

A python package for constructing and analysing minimum spanning trees.
MIT License
48 stars 23 forks source link

pip install failed In Windows #26

Open cloneorcopy opened 3 days ago

cloneorcopy commented 3 days ago

Hello, I failed to install mistree on Windows 10. (Python 3.11.5). I have moved the DLL file as advised (https://github.com/knaidoo29/mistree/issues/14#issuecomment-1275022276). But when importing mistree, the error report is as follows:

ImportError                               Traceback (most recent call last)
Cell In[8], [line 1](vscode-notebook-cell:?execution_count=8&line=1)
----> [1](vscode-notebook-cell:?execution_count=8&line=1) import mistree

File c:\Users\26655\anaconda3\Lib\site-packages\mistree\__init__.py:11
      [8](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/__init__.py:8) from .coordinates.coordinate_utility import perpendicular_distance_2_angle
     [10](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/__init__.py:10) # levy flight distributions
---> [11](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/__init__.py:11) from .levy_flight.levy_flight import get_random_flight
     [12](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/__init__.py:12) from .levy_flight.levy_flight import get_levy_flight
     [13](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/__init__.py:13) from .levy_flight.levy_flight import get_adjusted_levy_flight

File c:\Users\26655\anaconda3\Lib\site-packages\mistree\levy_flight\__init__.py:[1](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/__init__.py:1)
----> 1 from .levy_flight import get_random_flight
      [2](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/__init__.py:2) from .levy_flight import get_levy_flight
      [3](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/__init__.py:3) from .levy_flight import get_adjusted_levy_flight

File c:\Users\26655\anaconda3\Lib\site-packages\mistree\levy_flight\levy_flight.py:5
      [1](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:1) # 'levy_flight.py' has a number of functions that can generate random levy
      [2](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:2) # flight-like distributions.
      [4](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:4) import numpy as np
----> [5](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:5) from . import utility_random_walk as random_walk
      [8](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:8) def _get_randoms_sphere(size):
      [9](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:9)     """Generate random points on a sphere.
     [10](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:10) 
     [11](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:11)     Parameters
   (...)
     [21](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:21)         Latitude coordinate.
     [22](file:///C:/Users/26655/anaconda3/Lib/site-packages/mistree/levy_flight/levy_flight.py:22)     """
ImportError: DLL load failed while importing utility_random_walk: %1 is not a valid Win32 application

I don't know why this mistake occurred, maybe there is a problem with my compiler settings (I am using MSVC on my system).

knaidoo29 commented 1 day ago

Hi, I won't be able to help you on installing the default mistree on windows since I don't have a windows machine to test things on. However much of the issues with installs are to do with compiling the fortran files, so I suggest you install the python only version of mistree located in the python only branch. This will have all the functions most people use, but will not have Levy-flight functions and some density functions. If all you are interested in is the MST then this won't be a problem.

knaidoo29 commented 1 day ago

So the branch is called pure_python, installation is the same you just need to clone that specific branch and remember to import mistree as

import mistree_pp as mist

Instead of the usual import mistree. Hope that helps.