basilisp
basilisp copied to clipboard
Namespaces in the same project fail to resolve.
I'm experiencing a failure to require sibling namespaces.
This happens with basilisp run
as well as with cider even when the namespace is manually loaded into the repl.
I'm on a linux system and have basilisp installed with pip and bootstrapped in a venv with no other packages. I've also done the same experiment with the source files in the src
directory with the same result. Removing the :require
statement causes the file to run without error.
If you need anymore information please let me know.
Files:
-
./a.lpy
(ns a (:require [b]))
-
./b.lpy
(ns b)
Result:
$ basilisp version
Basilisp 0.1.0b2
$ python3 --version
Python 3.12.4
$ basilisp run a.lpy
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/runtime.py", line 662, in require
ns_module = importlib.import_module(munge(ns_name))
... stack omitted ...
ModuleNotFoundError: No module named 'b'
The above exception was the direct cause of the following exception:
... stack omitted ...
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/runtime.py", line 664, in require
raise ImportError(
ImportError: Basilisp namespace 'b' not found
Full Traceback:
Traceback (most recent call last):
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/runtime.py", line 662, in require
ns_module = importlib.import_module(munge(ns_name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'b'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/mitch/Sources/hello-basilisp/venv/bin/basilisp", line 8, in <module>
sys.exit(invoke_cli())
^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/cli.py", line 659, in invoke_cli
parsed_args.handler(parser, parsed_args)
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/cli.py", line 537, in run
eval_file(target, ctx, ns)
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/cli.py", line 52, in eval_file
return eval_str(f'(load-file "{filename}")', ctx, ns, eof=object())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/cli.py", line 46, in eval_str
last = compiler.compile_and_exec_form(form, ctx, ns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/compiler/__init__.py", line 191, in compile_and_exec_form
return getattr(ns.module, final_wrapped_name)()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a.lpy", line 1, in __lisp_expr___65
(ns a
^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4426, in load_file
(with-open [f (python/open path ** :mode "r")]
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4427, in load_file
(load-reader f)))
^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4392, in load_reader
(defn load-reader
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 2431, in dorun
(defn dorun
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 2441, in dorun__arity1
(recur (rest ptr)))))
File "/usr/lib/python3.12/functools.py", line 909, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/seq.py", line 295, in _to_seq_lazyseq
return o.seq()
^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/seq.py", line 209, in seq
self._compute_seq()
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/seq.py", line 205, in _compute_seq
self._obj = gen()
^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4411, in ____load_reader__for_3609_3628__lisp_fn_3630
(basilisp.lang.compiler/compile-and-exec-form form
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/compiler/__init__.py", line 189, in compile_and_exec_form
exec(bytecode, ns.module.__dict__) # pylint: disable=exec-used
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/a.lpy", line 3, in <module>
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4886, in require
(doseq [libspec (map require-libspec args)]
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 2431, in dorun
(defn dorun
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 2441, in dorun__arity1
(recur (rest ptr)))))
File "/usr/lib/python3.12/functools.py", line 909, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/seq.py", line 295, in _to_seq_lazyseq
return o.seq()
^^^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/seq.py", line 209, in seq
self._compute_seq()
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/seq.py", line 205, in _compute_seq
self._obj = gen()
^^^^^
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4892, in ____require__for_4002_4015__lisp_fn_4017
(require-lib current-ns libspec)
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4813, in require_lib
(eval (list 'require*
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4379, in eval_
(defn eval
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/core.lpy", line 4388, in eval___arity2
(basilisp.lang.compiler/compile-and-exec-form form
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/compiler/__init__.py", line 189, in compile_and_exec_form
exec(bytecode, ns.module.__dict__) # pylint: disable=exec-used
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Eval Input>", line 1, in <module>
File "/home/mitch/Sources/hello-basilisp/venv/lib/python3.12/site-packages/basilisp/lang/runtime.py", line 664, in require
raise ImportError(
ImportError: Basilisp namespace 'b' not found