pysat / pysatCDAAC

pysat support for CDAAC instruments
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

BUG: requests not installed #23

Closed rstoneback closed 2 years ago

rstoneback commented 3 years ago

New conda environment. Ran python setup.py develop on code in https://github.com/pysat/pysatCDAAC/pull/18. Upon attempted import I get an error about a lack of requests.

In [1]: import pysat

In [2]: gps = pysat.Instrument('cosmic', 'gps', 'ionprf', update_files=True)
pysat ERROR: unable to locate or import module for platform cosmic, name gps
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/Code/pysat/pysat/_instrument.py in _assign_attrs(self, by_name, inst_module, tag, inst_id)
   1195                 try:
-> 1196                     inst = importlib.import_module(mod)
   1197                 except ImportError as ierr:

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/__init__.py in import_module(name, package)
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name, package, level)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name, import_)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name, package, level)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name, import_)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name, package, level)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name, import_)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _load_unlocked(spec)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap_external.py in exec_module(self, module)

~/opt/anaconda3/envs/testingcdaac/lib/python3.8/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~/Code/pysatCDAAC/pysatCDAAC/__init__.py in <module>
----> 1 from pysatCDAAC import instruments  # noqa F401

~/Code/pysatCDAAC/pysatCDAAC/instruments/__init__.py in <module>
      3 for inst in __all__:
----> 4     exec("from pysatCDAAC.instruments import {x}".format(x=inst))

~/Code/pysatCDAAC/pysatCDAAC/instruments/__init__.py in <module>

~/Code/pysatCDAAC/pysatCDAAC/instruments/cosmic_gps.py in <module>
     48 import os
---> 49 import requests
     50 import tarfile

ModuleNotFoundError: No module named 'requests'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-2-6bfefd1ca5a1> in <module>
----> 1 gps = pysat.Instrument('cosmic', 'gps', 'ionprf', update_files=True)

~/Code/pysat/pysat/_instrument.py in __init__(self, platform, name, tag, inst_id, clean_level, update_files, pad, orbit_info, inst_module, directory_format, file_format, temporary_file_list, strict_time_flag, ignore_empty_files, labels, custom, **kwargs)
    231 
    232                 # Look to module for instrument functions and defaults
--> 233                 self._assign_attrs(by_name=True, tag=self.tag,
    234                                    inst_id=self.inst_id)
    235             elif (platform is None) and (name is None):

~/Code/pysat/pysat/_instrument.py in _assign_attrs(self, by_name, inst_module, tag, inst_id)
   1200                     estr = estr.format(self.platform, self.name)
   1201                     logger.error(estr)
-> 1202                     raise ImportError(ierr)
   1203         elif inst_module is not None:
   1204             # User supplied an object with relevant instrument routines

ImportError: No module named 'requests'
rstoneback commented 3 years ago

requests is listed in setup.cfg and in requirements.txt....

jklenzing commented 3 years ago

I thought that requirements are only auto-installed when installing from pip

rstoneback commented 3 years ago

I thought requirements were installed with a python setup.py blah with the exception if a package was already there, but out of version spec, it isn't updated.

jklenzing commented 2 years ago

Just created a new conda environment (python 3.7) and tried the above steps, have not been able to duplicate the bug.

jklenzing commented 2 years ago

@rstoneback, this issue was pre-v0.0.2 release (July 7). Looking through the previous version, it seems that install_requires was set up incorrectly in setup.cfg : https://github.com/pysat/pysatCDAAC/blob/v0.0.1/setup.cfg

The whole [options] section is tabbed over, which I think gets ignored when looking for requirements. I think this can be closed, unless you've seen this issue elsewhere. Sorry, forgot to bring this up at the meeting today.

rstoneback commented 2 years ago

Sounds good. I’m ok with the issue being closed. Thanks for the update.

On Oct 25, 2021, at 4:40 PM, Jeff Klenzing @.***> wrote:

@rstoneback https://github.com/rstoneback, this issue was pre-v0.0.2 release (July 7). Looking through the previous version, it seems that install_requires was set up incorrectly in setup.cfg : https://github.com/pysat/pysatCDAAC/blob/v0.0.1/setup.cfg https://github.com/pysat/pysatCDAAC/blob/v0.0.1/setup.cfg The whole [options] section is tabbed over, which I think gets ignored when looking for requirements. I think this can be closed, unless you've seen this issue elsewhere. Sorry, forgot to bring this up at the meeting today.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pysat/pysatCDAAC/issues/23#issuecomment-951353880, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3N26KLT6ODFRDF7X5WRS3UIXFFJANCNFSM46VNCV3Q. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.