khayyam icon indicating copy to clipboard operation
khayyam copied to clipboard

The C extension is not available. Switching to fallback python pure algorithms

Open mohammad2611373 opened this issue 7 years ago • 15 comments

What to do with this warning?

mohammad2611373 avatar Jan 07 '18 09:01 mohammad2611373

Install C compiler and python headers on your machine

pylover avatar Jan 15 '18 07:01 pylover

Please mention your environement

pylover avatar Jan 15 '18 07:01 pylover

gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mhosseinab avatar Aug 11 '18 12:08 mhosseinab

I have The same issu. ubuntu server 16.04 , python 3.6 , virtualenv i tried installing build-essential but it was not helpful.

ehsanonline avatar Nov 04 '18 17:11 ehsanonline

You have to install python-dev and or python3-dev as well as the build-essential package.

You man run python setup.py build_ext --inplace to examine what library you missed and so, install them.

As I knew, the only C prerequisite of the khayyam package is the python.h.

pylover avatar Nov 04 '18 19:11 pylover

Thanks! I installed build-essential , python3.6-dev , python3-setuptools and python3-dev , then I ran these commands on the cloned khayyam: python setup.py build_ext --inplace nosetests (it gives me errors though) pip install -e . (it reinstalled khayyam) now that error is gone!

ehsanonline avatar Jan 22 '19 15:01 ehsanonline

what to do with this warning on windows?

Environment: windows 10 python 3.8

fstackgeek avatar Apr 28 '20 18:04 fstackgeek

I have The same issue. Ubuntu server 18.04, python 3.6

Mahyar24 avatar Jun 05 '20 20:06 Mahyar24

I made some pre-build versions here for those who can't build it. just extract and copy in your site-packages folder instead of installing with pip : https://github.com/ehsanonline/khayyam_pre_build

ehsanonline avatar Aug 23 '20 23:08 ehsanonline

Hi guys. would you mind explaining how to build it on win10 21h2?

Install C compiler and python headers on your machine

like how?

I've tried to get all the packages mentioned above (build-essential , python-setuptools and python-dev) but I get this error for every single one of them: ERROR: Could not find a version that satisfies the requirement python-dev (from versions: none) ERROR: No matching distribution found for python-dev I searched a lot but I don't seem to get it. btw I'm using python 3.10. could you explain it in more detail for a novice like me? thank you

Aquarii avatar Dec 14 '22 21:12 Aquarii

Just throw your Window$ away :wink: , Or: install the appropriate C compiler: https://wiki.python.org/moin/WindowsCompilers

But I highly recommend you to not develop anything on Micro$oft Window$ (Trust me, It's will be overkill).

pylover avatar Dec 15 '22 23:12 pylover

I threw my windows away 😉 and did it in Debian 10. still the same.

gcc --version gcc (Debian 10.2.1-6) 10.2.1 20210110

apt show python3-dev Package: python3-dev Version: 3.9.2-3

apt show python3-setuptools Package: python3-setuptools Version: 52.0.0-4

apt show build-essential Package: build-essential Version: 12.9

I installed it using the setup.py provided in the package, like this: python setup.py install

did I do something wrong? any idea?

Aquarii avatar Dec 18 '22 20:12 Aquarii

It seems Ok,

Let me check it on Ubuntu 22.04.

pylover avatar Dec 20 '22 18:12 pylover

Everything is fine on a clean Ubuntu 22.04.

path/to/khayyam$ python3 setup.py build_ext --inplace
running build_ext
building 'khayyam.algorithms_c' extension
creating build
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/khayyam
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.10 -c khayyam/algorithms_c.c -o build/temp.linux-x86_64-cpython-310/khayyam/algorithms_c.o
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/khayyam
x86_64-linux-gnu-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 build/temp.linux-x86_64-cpython-310/khayyam/algorithms_c.o -L/usr/lib/x86_64-linux-gnu -o build/lib.linux-x86_64-cpython-310/khayyam/algorithms_c.cpython-310-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-cpython-310/khayyam/algorithms_c.cpython-310-x86_64-linux-gnu.so -> khayyam

Make sure the appropriate C compiler is in your path and accessible to Python's setuptools when needed.

As you see in the compilation output above, the x86_64-linux-gnu-gcc command was utilized by setuptools on my machine.

pylover avatar Dec 20 '22 18:12 pylover

Thank you for this great library. 🙏

For God's sake, could you please remove this warning? It's really annoying! And also I'm happy with pure python speed! 😄

Because of that, I have to use this piece of code whenever I want to use this lib!

import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=UserWarning) from khayyam import JalaliDatetime

dev4min avatar Mar 01 '23 09:03 dev4min