GithubHelp home page GithubHelp logo

lyncs-api / lyncs.io Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 4.67 MB

I/O functions for common Python and LQCD file formats

License: BSD 3-Clause "New" or "Revised" License

Python 93.05% Shell 1.23% C++ 5.73%

lyncs.io's People

Contributors

alexandrosangeli avatar chschneider122 avatar cstyl avatar jadot-bp avatar rjabi avatar sbacchio avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

lyncs.io's Issues

Incomplete Tar Implementation

TODO:

  • Support for HDF5 and nested Tar
  • Support for txt files

When trying to save txt files in a tar:

Click to expand! lambda fname, data, *args, **kwargs: fnc(data, fname, *args, **kwargs)

File "<array_function internals>", line 4, in savetxt

TypeError: _savetxt_dispatcher() got an unexpected keyword argument 'comm'

[BUG] importing `lyncs_io` raises `AttributeError` in python 3.8.

Describe the bug
A clear and concise description of what the bug is.

import lyncs_io in python 3.8+ yields the error

AttributeError: module 'importlib' has no attribute 'util'

Editing the problem file (lyncs_utils/extensions.py) such that importlib.utils is imported instead fixes this problem.

To Reproduce
If applicable, list the steps to reproduce the behavior:

This can be reproduced by simply importing lyncs_io using a fresh environment in python 3.8.

Error message / Output
If applicable, paste here the error messages / output you get.

Error(s) listed below:

Click to expand!
Traceback (most recent call last):
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_utils/extensions.py", line 52, in lazy_import
  return sys.modules[name]
KeyError: 'numpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "lyncs_test.py", line 1, in <module>
  import lyncs_io as io
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_io/__init__.py", line 5, in <module>
  from .base import *
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_io/base.py", line 13, in <module>
  from .formats import formats
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_io/formats.py", line 10, in <module>
  from lyncs_utils import open_file
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_utils/__init__.py", line 5, in <module>
  from .math import *
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_utils/math.py", line 17, in <module>
  from .numpy import numpy
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_utils/numpy.py", line 16, in <module>
  numpy = lazy_import("numpy")
File "/home/ben/anaconda3/envs/gluprop_test/lib/python3.8/site-packages/lyncs_utils/extensions.py", line 54, in lazy_import
  spec = importlib.util.find_spec(name)
AttributeError: module 'importlib' has no attribute 'util'

Installed versions
Paste here the output of lyncs_packages -v.

Versions listed below:

Click to expand!
cppyy==2.4.1
dataclasses==0.6
deprecated==1.2.13
filelock==3.9.0
gitpython==3.1.30
lyncs-cppyy==0.2.0
lyncs-io==0.2.3
lyncs-setuptools==0.3.1
lyncs-utils==0.4.4
numpy==1.24.1
packaging==23.0
pip==22.3.1
xmltodict==0.13.0

[BUG] DaskIO is unprotected and causing issues when lyncs_io is not installed with [all]

Installing lyncs_io from within another project's setup.py and then trying to load it fails with the following error:

ModuleNotFoundError: No module named 'filelock'
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-bb871a6d281e> in <module>
----> 1 from ML_Optimus.data.generate_raw import gen_from_poisson
      2 from ML_Optimus.data.conversions import dict_to_mat
      3 import lyncs_io as io

~/tmp/ML-Optimus/ML_Optimus/__init__.py in <module>
      5 __version__ = "0.0.1"
      6 
----> 7 from .data import *
      8 from .features import *
      9 from .model import *

~/tmp/ML-Optimus/ML_Optimus/data/generate_raw.py in <module>
      8 
      9 import numpy as np
---> 10 import lyncs_io as io
     11 import scipy
     12 

~/miniconda3/envs/test_lyncs/lib/python3.8/site-packages/lyncs_io/__init__.py in <module>
      3 __version__ = "0.1.0"
      4 
----> 5 from .base import *

~/miniconda3/envs/test_lyncs/lib/python3.8/site-packages/lyncs_io/base.py in <module>
     11 ]
     12 
---> 13 from .formats import formats
     14 from .utils import find_file
     15 

~/miniconda3/envs/test_lyncs/lib/python3.8/site-packages/lyncs_io/formats.py in <module>
     10 from lyncs_utils import open_file
     11 from .format import Formats
---> 12 from . import numpy, lime
     13 
     14 formats = Formats()

~/miniconda3/envs/test_lyncs/lib/python3.8/site-packages/lyncs_io/numpy.py in <module>
     30 from .utils import swap, is_dask_array
     31 from .mpi_io import MpiIO, check_comm
---> 32 from .dask_io import DaskIO
     33 
     34 loadtxt = numpy.loadtxt

~/miniconda3/envs/test_lyncs/lib/python3.8/site-packages/lyncs_io/dask_io.py in <module>
      6 import numpy
      7 
----> 8 from filelock import FileLock, Timeout
      9 from lyncs_utils import read, write
     10 from .convert import from_array

ModuleNotFoundError: No module named 'filelock'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.