jsalvatier / scikits.bvp_solver

Python package for solving two-point boundary value problems that wraps BVP_SOLVER
http://packages.python.org/scikits.bvp_solver/
14 stars 6 forks source link

Import error #6

Open jm52250 opened 5 years ago

jm52250 commented 5 years ago

I just installed scikits.bvp_solver. It seemed to install ok, but I get the following error.

import scikits.bvp_solver

Traceback (most recent call last):

File "", line 1, in import scikits.bvp_solver

File "C:\Users\John\Anaconda3\lib\site-packages\scikits\bvp_solver__init__.py", line 1, in from solver import solve

ModuleNotFoundError: No module named 'solver'

Any thoughts?

wingkitlee0 commented 5 years ago

Hi, There were some changes in Python 3 regarding how to import modules. Check out my fork below (or the recent pull request here) that I have fixed this: https://github.com/wingkitlee0/scikits.bvp_solver

Otherwise, python 2 should work out of the box.

Cheers, Kit

jm52250 commented 5 years ago

Kit:

Thanks for pointing me in the right direction. I tried the version off the GitHub and compiled using

python setup.py config --compiler=mingw32 build --compiler=mingw32 install

but still got errors. I'm on Windows 10 and using MinGW-w64. Think either of those could be a problem?

Thanks.

John

On Fri, Dec 21, 2018 at 2:02 PM Wing-Kit Lee notifications@github.com wrote:

Hi, There were some changes in Python 3 regarding how to import modules. Check out my fork below (or the recent pull request here) that I have fixed this: https://github.com/wingkitlee0/scikits.bvp_solver

Otherwise, python 2 should work out of the box.

Cheers, Kit

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jsalvatier/scikits.bvp_solver/issues/6#issuecomment-449509214, or mute the thread https://github.com/notifications/unsubscribe-auth/Ar4jMk55hgAkBwFZNJxGeYxq_FHB7WOXks5u7VpbgaJpZM4ZfFz4 .

-- John Meloling

wingkitlee0 commented 5 years ago

What errors you got? I think that might be due to some generic windows+python+gfortran library problems. You may get more help on elsewhere since there is no enough manpower here.

Also, you should try the "bash on ubuntu on windows" on win 10. it's basically a Linux bash shell and I have no problem using any python packages in there (e.g., install anaconda).

wingkitlee0 commented 5 years ago

Hi John,

Here is a workaround, which I tested on my windows machine (win 10 + python 3 (anaconda) + gfortran (ming-w64) + cmd prompt):

  1. Start with a clean python environment or uninstall/delete previous scikits.bvp_solver in site_packages
  2. Make sure gfortran.exe in the path ( I was using ming-w64).
  3. In the root directory of the repo, type: python setup.py build
  4. Under build\lib.win-amd64-3.6\scikits\bvp_solver directory, you should find a file with .pyd extension. This file needs the dll located at ..\.libs\, so you need to copy that dll file to this dir: copy ..\.libs\libBVP_M.*.dll . This should copy one dll file to the current directory.
  5. Go back to the root dir of the repo, and run python setup.py install
  6. Go to other directory and test your code. Note that many of the examples are not updated to python 3. But ExampleC1.py should work.

Note: No "--compiler=mingw32" flag needed if gfortran is the only fortran you have.

Cheers, Kit

ZJLucky commented 2 months ago

Hi Kit:

I used windows 11 (win 11 + python 3 (anaconda) + gfortran (ming-w64) + cmd prompt), and I followed the steps that you shared, and it seems to have installed successfully. However, when I tested ExampleC1.py, I encountered the following error

D:\Python_install_no_delete\python.exe "D:\google chrome download\scikits.bvp_solver-master\scikits.bvp_solver-master\scikits\bvp_solver\examples\ExampleC1.py" Traceback (most recent call last): File "D:\google chrome download\scikits.bvp_solver-master\scikits.bvp_solver-master\scikits\bvp_solver\examples\ExampleC1.py", line 3, in import scikits.bvp_solver as bvp File "D:\Python_install_no_delete\Lib\site-packages\scikits\bvp_solver__init__.py", line 1, in from .solver import solve File "D:\Python_install_no_delete\Lib\site-packages\scikits\bvp_solver\solver.py", line 1, in from . import bvp_solverf ImportError: DLL load failed while importing bvp_solverf:

Thanks Jun

ZJLucky commented 2 months ago

I have fixed this error.

I added the following code in the top row: import os os.add_dll_directory(r"D:\Python_install_no_delete\Lib\site-packages\scikits.libs")

Thanks Jun