Python Forum
Scipy sparse setuptools issues
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scipy sparse setuptools issues
#1
check the histogram plot for the clustering doc and data set yet test pass but result is zero

The output test 100% but zero result
Error:
test_clustering_probability.py::TestSet::test_will_work PASSED [100%] ============================== warnings summary =============================== ..\..\Python3.8.0\Python\lib\site-packages\scipy\sparse\sparsetools.py:21 D:\Python3.8.0\Python\lib\site-packages\scipy\sparse\sparsetools.py:21: DeprecationWarning: `scipy.sparse.sparsetools` is deprecated! scipy.sparse.sparsetools is a private module for scipy.sparse, and should not be used. _deprecated() -- Docs: https://docs.pytest.org/en/stable/warnings.html ======================== 1 passed, 1 warning in 2.82s ========================= Process finished with exit code 0

I want to manipulate and and execute the histogram and for my data set and to check the similarity but i have to face this issues
How did solve this issue of Sparse Tools for Scipy
Warning summery output
Error:
============================== warnings summary =============================== ..\..\Python3.8.0\Python\lib\site-packages\scipy\sparse\sparsetools.py:21 D:\Python3.8.0\Python\lib\site-packages\scipy\sparse\sparsetools.py:21: DeprecationWarning: `scipy.sparse.sparsetools` is deprecated! scipy.sparse.sparsetools is a private module for scipy.sparse, and should not be used. _deprecated() -- Docs: https://docs.pytest.org/en/stable/warnings.html ======================== 1 passed, 1 warning in 1.89s ========================= Process finished with exit code 0
Reply
#2
see: https://github.com/RaRe-Technologies/gensim/issues/462
Reply
#3
This is a duplicate post. Please refer to https://python-forum.io/thread-34017.html for possible answer.
Please don't post more that once. We read all forums.
Yoriz write Jun-19-2021, 01:36 PM:
Threads are now merged
Reply
#4
You have post to what code/library you use.
sparsetools was removed from SciPy serval years ago.
If install a new version of SciPy in virtual environment.
(my_env) G:\miniconda3
λ ptpython
>>> from scipy import sparse
>>>
>>> sparse.sparsetools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'scipy.sparse' has no attribute 'sparsetools'
module 'scipy.sparse' has no attribute 'sparsetools'

>>> [m for m in dir(sparse) if not m.startswith('__')]
['SparseEfficiencyWarning', 'SparseWarning', '_csparsetools', '_index', '_matrix_io', '_sparsetools',
 '_warnings', 'base', 'block_diag', 'bmat', 'bsr', 'bsr_matrix', 'compressed', 'construct', 'coo',
'coo_matrix', 'csc', 'csc_matrix', 'csgraph', 'csr', 'csr_matrix', 'data', 'dia', 'dia_matrix',
'diags', 'dok', 'dok_matrix', 'extract', 'eye', 'find', 'hstack', 'identity',
'issparse', 'isspmatrix', 'isspmatrix_bsr', 'isspmatrix_coo', 'isspmatrix_csc', 'isspmatrix_csr',
'isspmatrix_dia', 'isspmatrix_dok', 'isspmatrix_lil', 'kron', 'kronsum', 
'lil', 'lil_matrix', 'load_npz', 'rand', 'random', 'save_npz', 'spdiags', 'spmatrix', 'sputils', 'test', 'tril', 'triu', 'vstack']
So it's still there but now has _sparsetools,which mean that it should not be used.
>>> from scipy import sparse
>>>
>>> sparse._sparsetools.bsr_diagonal
<built-in function bsr_diagonal>

>>> sparse._sparsetools.bsr_elmul_bsr
<built-in function bsr_elmul_bsr>
Reply
#5
it return me waring for these libraries in my codes lines there are no scipy library
from sklearn import cluster
import numpy as np
import json
import sys
import codecs
from nltk.corpus import wordnet
from collections import defaultdict
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
from gensim.models import KeyedVectors
import unittest

Lines 20 warning return me these notions
"""
sparsetools is not a public module in scipy.sparse, but this file is
for backward compatibility if someone happens to use it.
"""
from numpy import deprecate

# This file shouldn't be imported by scipy --- SciPy code should use
# internally scipy.sparse._sparsetools


@deprecate(old_name="scipy.sparse.sparsetools",
           message=("scipy.sparse.sparsetools is a private module for scipy.sparse, "
                    "and should not be used."))
def _deprecated():
    pass


del deprecate

try:
    _deprecated()
except DeprecationWarning:
    # don't fail import if DeprecationWarnings raise error -- works around
    # the situation with NumPy's test framework
    pass

from ._sparsetools import *
Reply
#6
Many of these libraries has lot of underlaying libraries.
gemsim
Quote:This software depends on NumPy and Scipy <http://www.scipy.org/Download>_, two Python packages for scientific computing.
You must have them installed prior to installing gensim.
Post link to what you try to run.

Also warnings can in many cases just be ignored as code will still run fine.
If look at this tutorial ,same error message.
So do he just use code under to not see them.
warnings.filterwarnings('ignore')  # To ignore all warnings that arise here to enhance clarity
Anldra12 likes this post
Reply
#7
@snippsat yes but i dont got result for the the clusters from the data model that i used
Error:
warnign scipy for gemsim
Reply
#8
The issue bug message for gensim.
Quote:I don't think we can do much about sparsetools (scipy provides no alternative AFAIK)

Would it make sense to just squash this warning by surrounding the import with a try/except?
The warning is certainly relevant to gensim maintainers, but for gensim users, it's mainly just an annoyance.

I don't think there's anything that needs to be done on gensim's end.
(Jun-19-2021, 01:50 PM)Anldra12 Wrote: yes but i dont got result for the the clusters from the data model that i used
Then as show over so is the warning not the problem,then is something wrong with your code.
Reply
#9
@snippsat Docs: see the link .html
-- Docs: https://docs.pytest.org/en/stable/warnings.html
for unittest i used these lines of codes

class TestSet(unittest.TestCase):

    def test_will_work(self):
        pass

    def will_not_work(self):
        pass
if i didn't use above lines of codes for unittest its throght follow error

Error:
collecting ... collected 0 items =============class TestSet(unittest.TestCase): def test_will_work(self): pass def will_not_work(self): pass================= warnings summary =============================== ..\..\Python3.8.0\Python\lib\site-packages\scipy\sparse\sparsetools.py:21 D:\Python3.8.0\Python\lib\site-packages\scipy\sparse\sparsetools.py:21: DeprecationWarning: `scipy.sparse.sparsetools` is deprecated! scipy.sparse.sparsetools is a private module for scipy.sparse, and should not be used. _deprecated() -- Docs: https://docs.pytest.org/en/stable/warnings.html ============================= 1 warning in 3.09s ============================== Process finished with exit code 5 Empty suite Empty suite
Reply
#10
As mention is just an annoyance can ignore it,or look this this for unittest.
I use pytest then there is eg pytest --disable-pytest-warnings
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Setuptools CLI program ModuleNotFoundError after splitting up module into package Postbote 1 2,323 Nov-25-2021, 06:35 PM
Last Post: Postbote
  ImportError:DLL Load Failed after importing scipy.sparse.linalg sea_jam 0 2,356 Jul-31-2020, 01:54 AM
Last Post: sea_jam
  ModuleNotFoundError: No module named 'scipy.optimize'; 'scipy' is not a package AaronKR 1 10,268 Jul-09-2020, 02:36 AM
Last Post: bowlofred
  Upgrade Setuptools on Python 3.4 Alexver 2 7,933 Sep-20-2018, 06:22 AM
Last Post: Alexver
  Python3 No Module Named gi, Tkinter, setuptools and more... On Fedora Linux harun2525 12 14,093 Aug-11-2018, 12:48 AM
Last Post: Larz60+
  setuptools bromberg 3 3,532 Jun-30-2018, 01:57 PM
Last Post: snippsat
  setuptools setup problem TomGeorge 7 8,658 Dec-30-2016, 06:07 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020