SuperElastix / SimpleElastix

Multi-lingual medical image registration library
http://simpleelastix.github.io
Apache License 2.0
509 stars 149 forks source link

install the python module on Windows #362

Closed lzhan132 closed 4 years ago

lzhan132 commented 4 years ago

Hello,

It seems some people have reported this but I still couldn't find a clear solution to it - in the last step of installing the python module on Windows, there is no such folder called "/Wrapping/Python/Packaging" under "SimpleITK-build", and no file called "setup.py" in it. People have pointed out that it may be an issue coming from the improper Python Path. I tried adding Python Path under Anaconda to the system so that it can be accessed through cmd, but it didn't solve the problem. Then I uninstalled Anaconda, re-installed a separate Python and added Python Path to the system, and it didn't solve the problem, either. Could someone share some experience on how to solve this? I would appreciate your help.

Linghua

CMakeCacheInit.txt

image

image

lzhan132 commented 4 years ago

I solved this by doing the following:

  1. Re-install Anaconda3, add to PATH while installing (although it's not recommended by the installer). Make sure Python can be accessed by the system by checking in cmd. Just type "python" and see if its version pops out.
  2. Make sure your folder name does not contain any space (" ") as I do, especially for Windows users; If it does have space, choose another folder without any space in its name.
  3. Run CMake and "generate" python files. The build takes over 1 hr, and should end up with a notification of success.
  4. Copy _SimpleITK.pyd from the ...\Python\ directory to ...\Python\Packaging, as mentioned by "thatguy14"in https://github.com/SuperElastix/SimpleElastix/issues/233
  5. Open Anaconda Navigator, then open x64 native tools command prompt for VS, and install the python module following instructions in https://simpleelastix.readthedocs.io/GettingStarted.html

Hope it is helpful to others who meet the same problem!

enochkan commented 4 years ago

I've also encountered the same problem. Reinstalling python (added to the PATH variable) and cmake didn't help. Any idea why?

enochkan commented 4 years ago

I noticed when I hit "generate" it almost completes instantly, and nothing's being actually built by cmake.

lzhan132 commented 4 years ago

I've also encountered the same problem. Reinstalling python (added to the PATH variable) and cmake didn't help. Any idea why?

Did you check in cmd if your system can access Python? If it does, and your folder name is normal, then I have no idea what might have happened in your case...

enochkan commented 4 years ago

I did. What version of Python are you using? I'm using 3.8.5 with VS 16 2019.

enochkan commented 4 years ago

and cmake 3.18.2

lzhan132 commented 4 years ago

I did. What version of Python are you using? I'm using 3.8.5 with VS 16 2019.

I'm using Python 3.7.6 under Anaconda 3. My cmake version is 3.16.5.

enochkan commented 4 years ago

Let me see if I can replicate it. Thanks!

lzhan132 commented 4 years ago

Let me see if I can replicate it. Thanks!

My pleasure. Good luck!

enochkan commented 4 years ago

and did you built it with cmake gui?

lzhan132 commented 4 years ago

and did you built it with cmake gui?

Yep, I built it with cmake gui.