0

If I do a pip list in my virtualenv I see that ibm-cos-sdk(ibm_boto3) is installed.

However, when I run my application I get this error:

(venv36) Pauls-MBP-3:sdk-python-config-test me$ nosetests --process-timeout=1200
E
======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'ibm_boto3')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/me/git/sdk-python-config-test/cos_config_test/test_config_sdk.py", line 3, in <module>
    import ibm_boto3
ModuleNotFoundError: No module named 'ibm_boto3'

----------------------------------------------------------------------
Ran 1 test in 0.007s

FAILED (errors=1)

What causes this?

runnerpaul
  • 5,942
  • 8
  • 49
  • 118

1 Answers1

0
$ nosetests --process-timeout=1200

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest

You don't run your application — you run nosetests. Here we see that you run it from the global site-packages hence it uses a global Python, not Python from your virtual environment. And global Python cannot find your module because it's install in the virtual environment.

Install nose in the same virtual environment to run it with Python from the virtualenv.

phd
  • 82,685
  • 13
  • 120
  • 165