census-bds/usdot-phmsa-hazmat-parser

env setup -- README + requirements.txt

Opened this issue · 2 comments

The readme specifies a command conda create --name env_name --file requirements.txt . This fails on my windows machine. Other permutations of conda commands (e.g. conda env create ) also fail.

(base) C:\Users\mosca303\Documents\usdot-phmsa-hazmat-parser>conda create --name phmsa --file requirements.txt

InvalidVersionSpec: Invalid version ' 0 . 2 . 0 ': invalid character(s)

Other comments:

  • Rename requirements.txt to environment.yml . Typically, the python ecosystem uses environment.yml to denote a conda environment. requirements.txt would refer to a pip-based environment. As such, this should be renamed to environment.yml
  • Make sure to be clear in instructions as well that user will need to conda install. Include conda create command (vs having in the environment file).
  • With installation steps, I'm partial to a numbered list (vs the narrative format it's currently in). Easier to reference steps that way. Even better if each step is just copying/pasting a command provided.

@cmoscardi Can you try conda env create on the new environment.yml file I pushed when you get the chance?

I ran into two issues (on windows. this could be b/c the environment on my laptop is weird and i rarely use it):

  1. Try that exact command. But, I don't want to overwrite my whole environment?
(base) C:\Users\mosca303\Downloads\usdot-phmsa-hazmat-parser-master\usdot-phmsa-hazmat-parser-master>conda create -f environment.yml
WARNING: A conda environment already exists at 'C:\Users\mosca303\Miniconda3_2'
Remove existing environment (y/[n])? n
  1. Google says use conda env create -f environment.yml
(base) C:\Users\mosca303\Downloads\usdot-phmsa-hazmat-parser-master\usdot-phmsa-hazmat-parser-master>conda env create -f environment.yml

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "C:\Users\mosca303\conda\lib\site-packages\conda\exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "C:\Users\mosca303\conda\lib\site-packages\conda_env\cli\main.py", line 80, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "C:\Users\mosca303\conda\lib\site-packages\conda_env\cli\main_create.py", line 86, in execute
        spec = specs.detect(name=name, filename=filename, directory=os.getcwd())
      File "C:\Users\mosca303\conda\lib\site-packages\conda_env\specs\__init__.py", line 43, in detect
        if spec.can_handle():
      File "C:\Users\mosca303\conda\lib\site-packages\conda_env\specs\yaml_file.py", line 18, in can_handle
        self._environment = env.from_file(self.filename)
      File "C:\Users\mosca303\conda\lib\site-packages\conda_env\env.py", line 157, in from_file
        return from_yaml(yamlstr, filename=filename)
      File "C:\Users\mosca303\conda\lib\site-packages\conda_env\env.py", line 138, in from_yaml
        data = yaml_safe_load(yamlstr)
      File "C:\Users\mosca303\conda\lib\site-packages\conda\common\serialize.py", line 67, in yaml_safe_load
        return yaml.safe_load(string, version="1.2")
      File "C:\Users\mosca303\conda\lib\site-packages\ruamel_yaml\main.py", line 669, in safe_load
        return load(stream, SafeLoader, version)
      File "C:\Users\mosca303\conda\lib\site-packages\ruamel_yaml\main.py", line 638, in load
        loader = Loader(stream, version, preserve_quotes=preserve_quotes)
      File "C:\Users\mosca303\conda\lib\site-packages\ruamel_yaml\loader.py", line 35, in __init__
        Reader.__init__(self, stream, loader=self)
      File "C:\Users\mosca303\conda\lib\site-packages\ruamel_yaml\reader.py", line 80, in __init__
        self.stream = stream  # type: Any  # as .read is called
      File "C:\Users\mosca303\conda\lib\site-packages\ruamel_yaml\reader.py", line 112, in stream
        self.check_printable(val)
      File "C:\Users\mosca303\conda\lib\site-packages\ruamel_yaml\reader.py", line 233, in check_printable
        'unicode', "special characters are not allowed")
    ruamel_yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed
      in "<unicode string>", position 3