Skip to content

prmspy CLI import errors when installing PRMS-Python with python 2 #23

Description

@JohnVolk

prmspy works as expected when installing with pip3, I modified the init to have absolute imports to fix an installation bug with pip2 by adding absolute imports as opposed to relative i.e.

from prms_python.data import Data
# instead of

from .data import Data

This fixed errors when trying to install using pip2. However the prmspy script gives the following errors:

$ prmspy 
PRMS-Python/prms_python/__init__.py:19: RuntimeWarning: Parent module 'prms-python' not found while handling absolute import
  from prms_python.data import Data
PRMS-Python/prms_python/__init__.py:20: RuntimeWarning: Parent module 'prms-python' not found while handling absolute import
  from prms_python.optimizer import Optimizer, OptimizationResult
PRMS-Python/prms_python/__init__.py:21: RuntimeWarning: Parent module 'prms-python' not found while handling absolute import
  from prms_python.parameters import Parameters, modify_params
PRMS-Python/prms_python/__init__.py:22: RuntimeWarning: Parent module 'prms-python' not found while handling absolute import
  from prms_python.simulation import Simulation, SimulationSeries
PRMS-Python/prms_python/__init__.py:23: RuntimeWarning: Parent module 'prms-python' not found while handling absolute import
  from prms_python.scenario import Scenario, ScenarioSeries
PRMS-Python/prms_python/__init__.py:24: RuntimeWarning: Parent module 'prms-python' not found while handling absolute import
  from prms_python.util import load_statvar, load_data_file, nash_sutcliffe
Traceback (most recent call last):
  File "/usr/local/bin/prmspy", line 9, in <module>
    load_entry_point('prms-python', 'console_scripts', 'prmspy')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 547, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2380, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2386, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named scripts.prmspy

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions