Open satrio-yudhoatmojo opened 3 years ago
I have the same issue with Python 3.9 on Ubuntu 18.04...any luck?
I'm afraid not.
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
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 https://github.com/bhargavchippada/forceatlas2/blob/da3ece0b559efcc1cee51bd0f1d56db4732ce50c/fa2/fa2util.c#L427-L453
Oh. My cython 0.29.26 got it wrong. (No idea when cython will fully support python 3.9+)
Have the same issue with python 3.9.1. Fixed with rolling back to 3.8.13
with my virtual env.
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.
Bumping this as still being an issue on Python 3.9.15
@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.
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
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.
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.
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
Same error with Python 3.10 and Cython 3.0.
[Unknow](error: unknown file type '.pxd' (from 'fa2/fa2util.pxd'))
I managed to solve this issue with modifying the setup.py file: https://github.com/bhargavchippada/forceatlas2/pull/46
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
@eugbrenner You still need to have Cython installed indeed. The modification I made is to make it work with newer versions of Cython
@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. 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
?
Hi, @AminAlam ,
What I did from the very begining is:
These venvs are:
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?
@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
.
@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
@eugbrenner Please use the codes in ./lib.linux-x86_64-cpython-38/fa2_modified
and see if the warning is resolved.
@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.
@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 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.
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
It seems that fa2 is not compatible with Python3.9
`ERROR: Command errored out with exit status 1: command: /usr/local/opt/python@3.9/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)
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.9/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. `