Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't import library on python 3.7

See original GitHub issue

Hi, using Python 3.7, I can’t use the pathfinding module.

I’ve tried in an virtualenv and by installing it directly in the system packages.

Error is:

Traceback (most recent call last):
  File "", line 1, in <module>
    from pathfinding.core.diagonal_movement import DiagonalMovement
  File "", line 1, in <module>
    from pathfinding.core.diagonal_movement import DiagonalMovement
ModuleNotFoundError: No module named 'pathfinding.core'; 'pathfinding' is not a package

Process finished with exit code 1

Sample code used:

from pathfinding.core.diagonal_movement import DiagonalMovement
from pathfinding.finder.a_star import AStarFinder
from pathfinding.core.grid import Grid

matrix = [
    [1, 1, 1],
    [1, 0, 1],
    [1, 1, 1]
grid = Grid(matrix=matrix)

start = grid.node(0, 0)
end = grid.node(2, 2)

finder = AStarFinder(diagonal_movement=DiagonalMovement.always)
path, runs = finder.find_path(start, end, grid)

print('operations:', runs, 'path length:', len(path))
print(grid.grid_str(path=path, start=start, end=end))

Any idea how to make it work?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

breancommented, Mar 4, 2019

Ah, I should have seen this earlier in your first post, your file is named! Just rename it to something else! (e.g. and you should be fine 😄


RphlBrdtcommented, Mar 4, 2019

Thank you so much. You have resolve our problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 3.7 can't import modules - Stack Overflow
From my personal experience(with other modules), uninstalling the module using pip uninstall selenium and reinstalling it using pip install ...
Read more >
Why Can't Python Find My Modules? - Real Python
A common error that new Pythonistas will come across is that the packages they think they've installed are not actually being recognized by ......
Read more >
Cannot import Python Libraries anywhere - Super User
I am on MacOS 10.14.5. I currently cannot import any Python third-party Library from anywhere (including VSCode, Pycharm and terminal). Detail.
Read more >
5. The import system — Python 3.11.1 documentation
When a module is first imported, Python searches for the module and if found, it creates a module object 1, initializing it. If...
Read more >
Resolve "Unable to import module" errors from Python ...
You typically receive this error when your Lambda environment can't find the specified library in the Python code. This is because Lambda ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found