Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem installing fa2 on Python3.9 #34

Open
satrio-yudhoatmojo opened this issue Jun 27, 2021 · 28 comments
Open

Problem installing fa2 on Python3.9 #34

satrio-yudhoatmojo opened this issue Jun 27, 2021 · 28 comments

Comments

@satrio-yudhoatmojo
Copy link

It seems that fa2 is not compatible with Python3.9

`ERROR: Command errored out with exit status 1:
command: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-install-345a9yt5/fa2_127e2c475c0344ff93462856df90b805/setup.py'"'"'; file='"'"'/private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-install-345a9yt5/fa2_127e2c475c0344ff93462856df90b805/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-record-tehayj72/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/fa2
cwd: /private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-install-345a9yt5/fa2_127e2c475c0344ff93462856df90b805/
Complete output (214 lines):
Installing fa2 package (fastest forceatlas2 python implementation)

>>>> Cython is installed?
Cython is not installed; using pre-generated C files if available
Please install Cython first and try again if you face any installation problems

>>>> Are pre-generated C files available?
Yes

>>>> Starting to install!

running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.9
creating build/lib.macosx-10.15-x86_64-3.9/fa2
copying fa2/fa2util.py -> build/lib.macosx-10.15-x86_64-3.9/fa2
copying fa2/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/fa2
copying fa2/forceatlas2.py -> build/lib.macosx-10.15-x86_64-3.9/fa2
running egg_info
writing fa2.egg-info/PKG-INFO
writing dependency_links to fa2.egg-info/dependency_links.txt
writing requirements to fa2.egg-info/requires.txt
writing top-level names to fa2.egg-info/top_level.txt
reading manifest file 'fa2.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'fa2.egg-info/SOURCES.txt'
copying fa2/fa2util.c -> build/lib.macosx-10.15-x86_64-3.9/fa2
copying fa2/fa2util.pxd -> build/lib.macosx-10.15-x86_64-3.9/fa2
running build_ext
building 'fa2.fa2util' extension
creating build/temp.macosx-10.15-x86_64-3.9
creating build/temp.macosx-10.15-x86_64-3.9/fa2
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c fa2/fa2util.c -o build/temp.macosx-10.15-x86_64-3.9/fa2/fa2util.o
fa2/fa2util.c:10939:33: error: no member named 'tp_print' in 'struct _typeobject'
  __pyx_type_3fa2_7fa2util_Node.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
fa2/fa2util.c:10947:33: error: no member named 'tp_print' in 'struct _typeobject'
  __pyx_type_3fa2_7fa2util_Edge.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
fa2/fa2util.c:10960:35: error: no member named 'tp_print' in 'struct _typeobject'
  __pyx_type_3fa2_7fa2util_Region.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
fa2/fa2util.c:12133:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12133:22: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12133:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12133:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                   ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12133:52: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                   ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12133:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                   ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12149:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12149:26: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12149:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12149:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                          ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12149:59: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                          ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
fa2/fa2util.c:12149:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                          ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
12 warnings and 3 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------

ERROR: Command errored out with exit status 1: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-install-345a9yt5/fa2_127e2c475c0344ff93462856df90b805/setup.py'"'"'; file='"'"'/private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-install-345a9yt5/fa2_127e2c475c0344ff93462856df90b805/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/tb/yb5np6tx5tg852_7ktrz3qy40000gn/T/pip-record-tehayj72/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/fa2 Check the logs for full command output.
`

@msalaciak
Copy link

I have the same issue with Python 3.9 on Ubuntu 18.04...any luck?

@satrio-yudhoatmojo
Copy link
Author

I'm afraid not.

@emigre459
Copy link

bump on this, anything anyone has found to correct? I'm afraid the HoloViews/Datashader implementations aren't very fast, so I'm really hoping to use this one

@kruus
Copy link

kruus commented Jan 24, 2022

I also had issues, for the same reason.
I hacked around it by avoiding calls to the offending function.
I was able to run examples/forceatlas2-layout.ipynb completely under python 3.9.7
(well after also removing some networkx with_labels argument in one line of the notebook)

I have...

Python version #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021
sys.platform='linux'
3.9.7

My hack prepended this section into fa2util.c and totally guessed how to avoid GET_SIZE completely...

#if PY_VERSION_HEX > 0x03090000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (1)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      PyUnicode_GET_LENGTH(u)
  #define PyUnicode_GET_SIZE(u)           PyUnicode_GET_LENGTH(u)
#elif ...  as before ... PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)

beefing up code around

forceatlas2/fa2/fa2util.c

Lines 427 to 453 in da3ece0

#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
#define CYTHON_PEP393_ENABLED 0
#define PyUnicode_1BYTE_KIND 1
#define PyUnicode_2BYTE_KIND 2
#define PyUnicode_4BYTE_KIND 4
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
#endif

@kruus
Copy link

kruus commented Jan 24, 2022

Oh. My cython 0.29.26 got it wrong.
(No idea when cython will fully support python 3.9+)

@vasiliy0s
Copy link

Have the same issue with python 3.9.1. Fixed with rolling back to 3.8.13 with my virtual env.

@ojdo
Copy link

ojdo commented Apr 19, 2022

Just in case someone does not stumble over the workaround documented in #35: the current main branch compiles under Python 3.10, so:

git clone https://github.com/bhargavchippada/forceatlas2
cd forceatlas2
# having build dependencies installed
pip install . --user

compiles and installs fine also under current Python environments. It is really just the outdated last release, not a lack of maintenance of the codebase itself.

@dburkhardt
Copy link

Bumping this as still being an issue on Python 3.9.15

@Sriharsha-hatwar
Copy link

Sriharsha-hatwar commented Aug 20, 2023

@ojdo what is ther version of Cython you are using and what is the meaining of below line :

# having build dependencies installed

With your steps also, I am not able to install the library. I am getting the below errors :

error: unknown file type '.pxd' (from 'fa2/fa2util.pxd')

Let us know about what needs to be done.

@Sriharsha-hatwar
Copy link

Here is the issue to be precise :

Using cached tqdm-4.66.1-py3-none-any.whl (78 kB)
Building wheels for collected packages: fa2
  Building wheel for fa2 (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Installing fa2 package (fastest forceatlas2 python implementation)
      
      >>>> Cython is installed?
      Yes
      
      >>>> Starting to install!
      
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.1-arm64-cpython-310
      creating build/lib.macosx-11.1-arm64-cpython-310/fa2
      copying fa2/fa2util.py -> build/lib.macosx-11.1-arm64-cpython-310/fa2
      copying fa2/forceatlas2.py -> build/lib.macosx-11.1-arm64-cpython-310/fa2
      running egg_info
      creating fa2.egg-info
      writing fa2.egg-info/PKG-INFO
      writing dependency_links to fa2.egg-info/dependency_links.txt
      writing requirements to fa2.egg-info/requires.txt
      writing top-level names to fa2.egg-info/top_level.txt
      writing manifest file 'fa2.egg-info/SOURCES.txt'
      reading manifest file 'fa2.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'fa2/fa2util.c'
      adding license file 'LICENSE'
      writing manifest file 'fa2.egg-info/SOURCES.txt'
      copying fa2/fa2util.pxd -> build/lib.macosx-11.1-arm64-cpython-310/fa2
      running build_ext
      Compiling fa2/fa2util.py because it changed.
      [1/1] Cythonizing fa2/fa2util.py
      building 'fa2.fa2util' extension
      error: unknown file type '.pxd' (from 'fa2/fa2util.pxd')
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fa2
  Running setup.py clean for fa2
Failed to build fa2
ERROR: Could not build wheels for fa2, which is required to install pyproject.toml-based projects

@Yansr3
Copy link

Yansr3 commented Aug 22, 2023

I'm having the same issue of unknonw file type .pxd here with Python 3.10.9 and Cython 3.0.0.
I also tried with Cython 0.29.6, it showed other errors and still didn't work.

@Mashiro-Mirror
Copy link

Getting the same error too. Not only in Centos 8 but also in Windows 11. Cython 3.0.0 and different versions of python have been tried, including python 3.7.10 and python 3.10.8. All failed. Error messages are shown by the following:
Collecting fa2
Using cached fa2-0.3.5.tar.gz (435 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in d:\python3.10\lib\site-packages (from fa2) (1.23.4)
Requirement already satisfied: scipy in d:\python3.10\lib\site-packages (from fa2) (1.9.2)
Requirement already satisfied: tqdm in d:\python3.10\lib\site-packages (from fa2) (4.64.1)
Requirement already satisfied: colorama in d:\python3.10\lib\site-packages (from tqdm->fa2) (0.4.5)
Building wheels for collected packages: fa2
Building wheel for fa2 (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
Installing fa2 package (fastest forceatlas2 python implementation)

  >>>> Cython is installed?
  Yes

  >>>> Starting to install!

  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\fa2
  copying fa2\fa2util.py -> build\lib.win-amd64-3.10\fa2
  copying fa2\forceatlas2.py -> build\lib.win-amd64-3.10\fa2
  copying fa2\__init__.py -> build\lib.win-amd64-3.10\fa2
  running egg_info
  writing fa2.egg-info\PKG-INFO
  writing dependency_links to fa2.egg-info\dependency_links.txt
  writing requirements to fa2.egg-info\requires.txt
  writing top-level names to fa2.egg-info\top_level.txt
  reading manifest file 'fa2.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'fa2.egg-info\SOURCES.txt'
  copying fa2\fa2util.c -> build\lib.win-amd64-3.10\fa2
  copying fa2\fa2util.pxd -> build\lib.win-amd64-3.10\fa2
  running build_ext
  Compiling fa2/fa2util.py because it changed.
  [1/1] Cythonizing fa2/fa2util.py
  building 'fa2.fa2util' extension
  error: Don't know how to compile fa2/fa2util.pxd
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fa2
Running setup.py clean for fa2
Failed to build fa2
Installing collected packages: fa2
Running setup.py install for fa2 ... error
error: subprocess-exited-with-error

× Running setup.py install for fa2 did not run successfully.
│ exit code: 1
╰─> [29 lines of output]
Installing fa2 package (fastest forceatlas2 python implementation)

  >>>> Cython is installed?
  Yes

  >>>> Starting to install!

  running install
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\fa2
  copying fa2\fa2util.py -> build\lib.win-amd64-3.10\fa2
  copying fa2\forceatlas2.py -> build\lib.win-amd64-3.10\fa2
  copying fa2\__init__.py -> build\lib.win-amd64-3.10\fa2
  running egg_info
  writing fa2.egg-info\PKG-INFO
  writing dependency_links to fa2.egg-info\dependency_links.txt
  writing requirements to fa2.egg-info\requires.txt
  writing top-level names to fa2.egg-info\top_level.txt
  reading manifest file 'fa2.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'fa2.egg-info\SOURCES.txt'
  copying fa2\fa2util.c -> build\lib.win-amd64-3.10\fa2
  copying fa2\fa2util.pxd -> build\lib.win-amd64-3.10\fa2
  running build_ext
  building 'fa2.fa2util' extension
  error: Don't know how to compile fa2/fa2util.pxd
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> fa2

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

@rlorigro
Copy link

rlorigro commented Sep 1, 2023

I'm getting a similar set of errors on Python 3.10.12

 fa2/fa2util.c: In function ‘__Pyx_modinit_type_init_code’:
      fa2/fa2util.c:10939:32: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
      10939 |   __pyx_type_3fa2_7fa2util_Node.tp_print = 0;
            |                                ^

and a bunch of deprecation warnings

@Kaveh8
Copy link

Kaveh8 commented Sep 11, 2023

Same error with Python 3.10 and Cython 3.0.

[Unknow](error: unknown file type '.pxd' (from 'fa2/fa2util.pxd'))

@AminAlam
Copy link

AminAlam commented Nov 9, 2023

I managed to solve this issue with modifying the setup.py file:
#46

@eugbrenner
Copy link

I managed to solve this issue with modifying the setup.py file: #46

Switching off fa2/fautil.pxd seems to be a partial solution. This is what I get when run scanpy:
'No cython detected. Install cython and compile the fa2util module for a 10-100x speed boost.'

Complete solution still needed

@AminAlam
Copy link

@eugbrenner You still need to have Cython installed indeed. The modification I made is to make it work with newer versions of Cython

@eugbrenner
Copy link

@AminAlam. You are right, I did no have cython installed in this venv. Just fixed it. But still have this message
'Warning: uncompiled fa2util module. Compile with cython for a 10-100x speed boost.' and dramatic slowdown. So it would be great if fa2util module could be compiled correctly

@AminAlam
Copy link

AminAlam commented Apr 14, 2024

@AminAlam. You are right, I did no have cython installed in this venv. Just fixed it. But still have this message
'Warning: uncompiled fa2util module. Compile with cython for a 10-100x speed boost.' and dramatic slowdown. So it would be great if fa2util module could be compiled correctly

@eugbrenner This is not happening for me. In general, having Cython should be enough for compiling fa2util.py to fa2util.c. Can you please send the output of the this command python3 -v?

@eugbrenner
Copy link

eugbrenner commented Apr 15, 2024

Hi, @AminAlam ,

What I did from the very begining is:

  1. Git-cloned fa2 source files
  2. Backed up setup.py
  3. Uncommented line №41 in setup.py ('opts = {"py_modules": ["fa2.fa2util"]}')
  4. Used 'pip install .' from directory where setup.py is to install fa2 under some venvs.

These venvs are:

  1. python3.8.13 + cython-3.0.0
  2. python3.9.17 + cython-3.0.10
  3. python3.12.2 + cython - 3.0.10

Although, I managed to install fa2 on all these venvs without errors and warnings, running 'import fa2' results in the same warning in all these venvs. This warning says ' Warning: uncompiled fa2util module. Compile with cython for a 10-100x speed boost.'

Is there anything else I can do to speed up fa2 calculations?

@AminAlam
Copy link

AminAlam commented Apr 15, 2024

@eugbrenner Use the setup.py of this commit, and install it using python3 setyp.py install. please send me the list of folders within the "build" folder in the directory where you ran python3 setyp.py install.

@eugbrenner
Copy link

@AminAlam Thanks for your reply. I've done everything that you advised and managed to install fa2_modified into python3.9.17 + cython-3.0.10 and python3.8.13 + cython-3.0.0 virtual environments. Nevertheless, I still get 'Warning: uncompiled fa2util module. Compile with cython for a 10-100x speed boost.' when importing fa2_module at either venv.

Furthermore, since I need fa2 to use with scanpy, I get "WARNING: Package 'fa2' is not installed, falling back to layout 'fr'. To use the faster and better ForceAtlas2 layout, install package 'fa2' (pip install fa2)." warning.
"Import fa2_modified as fa2" does not save the situation. Have to roll back to the original fa2.
Thank you for your efforts.

Here is my build directory 'ls -R' output:
.:
bdist.linux-x86_64 lib.linux-x86_64-cpython-39 temp.linux-x86_64-cpython-39
lib.linux-x86_64-cpython-38 temp.linux-x86_64-cpython-38

./bdist.linux-x86_64:

./lib.linux-x86_64-cpython-38:
fa2_modified

./lib.linux-x86_64-cpython-38/fa2_modified:
fa2util.c fa2util.cpython-38-x86_64-linux-gnu.so fa2util.py forceatlas2.py init.py

./lib.linux-x86_64-cpython-39:
fa2_modified

./lib.linux-x86_64-cpython-39/fa2_modified:
fa2util.c fa2util.cpython-39-x86_64-linux-gnu.so fa2util.py forceatlas2.py init.py

./temp.linux-x86_64-cpython-38:
fa2_modified

./temp.linux-x86_64-cpython-38/fa2_modified:
fa2util.o

./temp.linux-x86_64-cpython-39:
fa2_modified

./temp.linux-x86_64-cpython-39/fa2_modified:
fa2util.o

@AminAlam
Copy link

@eugbrenner Please use the codes in ./lib.linux-x86_64-cpython-38/fa2_modified and see if the warning is resolved.

@AminAlam
Copy link

@eugbrenner I've changed fa2_modified PyPi setup to ensure it will compile "fa2util.pxd" to "fa2util.c". Please install it using pip install -U fa2_modified. The latest version is "0.3.9", and using this version, the warning should not be shown anymore. Also, fa2 codes should run very fast now.

@eugbrenner
Copy link

@AminAlam Version 0.3.9 can be installed and run on python3.9.17 + cython-3.0.10 fine! Thank you. Do you have any suggestions to make scanpy use it instead fa2?
scanpy.tl.draw_graph() keeps warning me " WARNING: Package 'fa2' is not installed, falling back to layout 'fr'. "

@AminAlam
Copy link

AminAlam commented Apr 17, 2024

@AminAlam Version 0.3.9 can be installed and run on python3.9.17 + cython-3.0.10 fine! Thank you. Do you have any suggestions to make scanpy use it instead fa2? scanpy.tl.draw_graph() keeps warning me " WARNING: Package 'fa2' is not installed, falling back to layout 'fr'. "

Nice! Happy to hear it's working for you. Regarding your problem: I suggest to change the source code of scapy to make it use fa2_modified instead of fa2. However, I've checked scanpy source code and it seems like they are not using fa2 module.

@dbtsshome
Copy link

Have the same issue with python 3.9.1. Fixed with rolling back to 3.8.13 with my virtual env.

you are a good person

@wfaalajr
Copy link

wfaalajr commented Aug 10, 2024

To anyone who are working on python 3.9+ (I'm on ptyhon3.11 myself) and want a solution that integrates fa2 with scanpy here's what I did:

[1] Install fa2_modified repo:
pip3.11 install fa2_modified

[2] Locate your python3.9+ installed package directory:
pip3.11 show fa2_modified

[3] Rename the fa2_modified and metadata directory names:
In macOS you can use the "Go to Folder..." Finder option and rename the fa2_modified and fa2_modified-0.3.10.dist-info folder names to fa2 and fa2-0.3.10.dist-info

Or do

mv path_to_site_packages/fa2_modified path_to_site_packages/fa2
mv path_to_site_packages/fa2_modified-0.3.10.dist-info path_to_site_packages/fa2-0.3.10.dist-info

Testing this this with scanpy:

adata = sc.read_h5ad("myscdata.h5ad")
sc.pp.filter_genes(adata, min_cells=10)
scv.pp.normalize_per_cell(adata)
sc.pp.log1p(adata)
sc.pp.highly_variable_genes(adata)
sc.pp.neighbors(adata)
sc.tl.draw_graph(adata)
sc.pl.draw_graph(adata, color='seurat_clusters')

Works well without the warning of 'fa2' not installed. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests