Skip to content
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

Import error #6

Open
jm52250 opened this issue Dec 21, 2018 · 6 comments
Open

Import error #6

jm52250 opened this issue Dec 21, 2018 · 6 comments

Comments

@jm52250
Copy link

jm52250 commented Dec 21, 2018

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
Copy link

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
Copy link
Author

jm52250 commented Dec 22, 2018 via email

@wingkitlee0
Copy link

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
Copy link

wingkitlee0 commented Dec 22, 2018

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
Copy link

ZJLucky commented Jul 9, 2024

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
Copy link

ZJLucky commented Jul 9, 2024

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

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

3 participants