SPARQL-Anything / PySPARQL-Anything

The SPARQL Anything Python library
Apache License 2.0
13 stars 2 forks source link

please document versions of things needed #20

Closed justin2004 closed 2 months ago

justin2004 commented 5 months ago

it would be nice to have some required versions documented. not sure how to run this thing.

Python 3.10.12 pip3 install install pysparql_anything

import pysparql_anything as sa

...

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
MarcoR1791 commented 5 months ago

Hi Justin,

I've just uninstalled and reinstalled the software on my machine and everything seems to be in working order.

This below I've just copied and pasted from my terminal after doing pip install pysparql-anything,

C:\Users\mr24397>py
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysparql_anything as sa
Welcome to PySPARQL Anything 0.9.0.2, the SPARQL Anything Python library.
No SPARQL Anything executable jar has been found in the installation folder.
Proceeding to download the SPARQL Anything 0.9.0 jar:
100%|██████████████████████████████████████████████████████████████████████████████| 198M/198M [00:17<00:00, 12.0MiB/s]
The Download was successful!
The system is now ready for use!
>>>

With respect to specifying dependencies, I'm dedicating issue #18 to that and if you have any tips/suggestions feel free to add a comment there! Will deffo take them into consideration. There is an updated version in the works, hopefully to be released some time in July, that is planned to address this.

In the meantime I propose to keep this issue open to address your installation problem. I'm not really sure right now about what is happening, especially as numpy is not used anywhere in the code. I'll try and see if I can find out anything more.

enridaga commented 5 months ago

Hi Justin, is there a stack trace alongside? We could probably generate a requirements.txt easily, in the meantime. Would that help?

justin2004 commented 5 months ago

hey @enridaga , here is the stack trace:

[nav] In [159]: import pysparql_anything as sa
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-159-714c79bb745c> in <module>
----> 1 import pysparql_anything as sa

~/.local/lib/python3.10/site-packages/pysparql_anything/__init__.py in <module>
     35     raise
     36 # Launches the JVM
---> 37 from pysparql_anything.sparql_anything import SparqlAnything

~/.local/lib/python3.10/site-packages/pysparql_anything/sparql_anything.py in <module>
      9 import rdflib
     10 import pandas as pd
---> 11 import networkx as nx
     12 import pysparql_anything.command as cmd
     13 from pysparql_anything.sparql_anything_reflection import SPARQLAnythingReflection

/usr/lib/python3/dist-packages/networkx/__init__.py in <module>
    113 from networkx.generators import *
    114
--> 115 import networkx.readwrite
    116 from networkx.readwrite import *
    117

/usr/lib/python3/dist-packages/networkx/readwrite/__init__.py in <module>
     13 from networkx.readwrite.nx_yaml import *
     14 from networkx.readwrite.gml import *
---> 15 from networkx.readwrite.graphml import *
     16 from networkx.readwrite.gexf import *
     17 from networkx.readwrite.nx_shp import *

/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py in <module>
    312
    313
--> 314 class GraphML(object):
    315     NS_GRAPHML = "http://graphml.graphdrawing.org/xmlns"
    316     NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"

/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py in GraphML()
    344         types = [(np.float64, "float"), (np.float32, "float"),
    345                  (np.float16, "float"), (np.float_, "float"),
--> 346                  (np.int, "int"), (np.int8, "int"),
    347                  (np.int16, "int"), (np.int32, "int"),
    348                  (np.int64, "int"), (np.uint8, "int"),

~/.local/lib/python3.10/site-packages/numpy/__init__.py in __getattr__(attr)
    322
    323         if attr in __former_attrs__:
--> 324             raise AttributeError(__former_attrs__[attr])
    325
    326         if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

[ins] In [160]:
MarcoR1791 commented 5 months ago

Looks like an issue with networkX. Did you have it already installed? And if so which version? It could be that it needs updating as that feature of numpy that it is relying on has been removed since.

Try maybe pip install --upgrade networkx pandas and see if that is the case for now.

But in general yes, I have unfortunately made the mistake of not specifying the pandas/nx versions along with the other specifications.