0

I have gone through similar questions but I still cant resolve the problem I have install the package and success but when I run my script it will always return no module name error.

I suspect something todo with the python path where the module may not in python path This is my code

from toscaparser.tosca_template import ToscaTemplate

path_to_yaml_file = 'cvx.yaml'
template = ToscaTemplate(path_to_yaml_file)
print(template.inputs)

error

from tosca_parser import ToscaTemplate
ModuleNotFoundError: No module named 'tosca_parser'

My python

python
Python 3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', 
'/home/cube1/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist- 
packages', '/usr/local/lib/python3.8/dist-packages/pytosca-0.2.1-py3.8.egg', 
'/usr/lib/python3/dist-packages']

Package is success install using pip

Requirement already satisfied: attrs>=16.3.0 in /usr/lib/python3/dist-packages (from 
cmd2>=1.0.0->cliff!=2.9.0,>=2.8.0->tosca-parser) (19.3.0)

Pip version

pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Run echo $PYTHONPATH only return blank line I did run the script in tosca-parser dir and it work. Thus, something is not right with tosca parser module and python path outside the dir. Need some help and advise how can I fix this. Thank you

chenoi
  • 575
  • 3
  • 8
  • 30
  • pip is always tied to the exact version of the python interpreter. The fact that "i installed it with pip" and it doesn't work in python itself indicates that your pip is not the same python interpreter you are running your code with .. – rasjani Jan 28 '23 at 14:58
  • pip version seems tied with python3.8. pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8) – chenoi Jan 29 '23 at 01:55

0 Answers0