ImportError while loading conftest.py while using pytest
See original GitHub issueHello, I am an Outreachy applicant and I am preparing my development environment to contribute to Jax. I have installed the Jax and system requirements as indicated in the contribution guide. Python version = 3.8.10. Jax installed on CPU. But when I make sure that the tests pass correctly, I get the following error:
ImportError while loading conftest '/home/carcablop/jax/conftest.py'.
conftest.py:16: in <module>
import jax
E File "/home/carcablop/jax/jax/__init__.py", line 27
E _warn(f"cloud_tpu_init failed: {repr(exc)}\n This a JAX bug; please report "
E ^
E SyntaxError: invalid syntax
When I run only “pytest” out of the root folder I get the following error:
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
rootdir: /home/carcablop
collected 0 items / 1 errors
==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
/usr/lib/python2.7/dist-packages/py/_path/common.py:383: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/lib/python2.7/dist-packages/py/_path/common.py:425: in gen
if p.check(dir=1) and (rec is None or rec(p))])
/usr/lib/python2.7/dist-packages/_pytest/main.py:667: in _recurse
ihook = self.gethookproxy(dirpath)
/usr/lib/python2.7/dist-packages/_pytest/main.py:482: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/usr/lib/python2.7/dist-packages/_pytest/config/__init__.py:424: in _getconftestmodules
mod = self._importconftest(conftestpath.realpath())
/usr/lib/python2.7/dist-packages/_pytest/config/__init__.py:463: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E ConftestImportFailure: (local('/home/carcablop/jax/conftest.py'), (<type 'exceptions.SyntaxError'>, SyntaxError('invalid syntax', ('/home/carcablop/jax/jax/__init__.py', 27, 78, ' _warn(f"cloud_tpu_init failed: {repr(exc)}\\n This a JAX bug; please report "\n')), <traceback object at 0x7efcdcbc47d0>))
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.10 seconds ===========================
Could someone help me with this error? , Maybe I have missed something in the configuration or installation?
Thank you so much. Carolina
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
ImportError while loading conftest - Python3 #7408 - GitHub
I am trying to use pytest-django for writing my unit tests. I have a project structure like: cwweb/ accounts/ tests/ test_views.py views.py ......
Read more >conftest.py ImportError: No module named Foo - Stack Overflow
The error says the conftest.py can not be loaded because of an ImportError . Try moving your import inside the foo fixture like...
Read more >Building neo4j app with Python - Problem with pytest
At least on my laptop running Mac OS X, Python 3.8.9. I get the following error: ImportError while loading conftest './tests/conftest.py'.
Read more >ImportError while loading conftest.py while using pytest
ImportError while loading conftest.py while using pytest. ... When I run only "pytest" out of the root folder I get the following error:...
Read more >Pytest -m connection: ImportError while loading conftest
ImportError while loading conftest '/Users/user/Dropbox/projects/code/mongodb/mflix-python/tests/conftest.py' - after I move project files.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Indeed, I had
libtpu
installed, I deleted it and the test is running without errors. Thank you.To see if you have
libtpu
installed and, if so, print its location, you can run this:This may have been installed, for example, if you accidentally followed the Cloud TPU installation instructions here: https://github.com/google/jax#pip-installation-google-cloud-tpu