Comments (70)
OK, thanks for letting me know! I presume the problem has something to do with the newest version of MacOS and the command-line tools. Unfortunately, I do not have access to the newest version at this point. But I will look into this soon. As for now, I hope you can use the library compiled from the source code. (If you have any question or an issue related to this, feel free to ask.)
from pysat.
OK, I see. Actually, this time the problem is not in PySAT. Observe that your installation process fails because of the pypbblib library, which is a dependency for PySAT. I will contact the authors of pypblib. Hopefully, they will find time to fix this problem.
from pysat.
I am glad it helped. Not sure what is happening with PyPBLib at this stage. It is a pity that it is not well maintained. The only way to report issues is to contact the authors by email.
from pysat.
Hi @moqingyan! Thank you for the interest in PySAT.
First of all, please, do not worry about the warnings you got. Some of them are related to the original source code of the SAT solvers. Some others arose because I was not careful enough. :) I will fix them in the next release. But in any case, these warning will not affect the library in any way. It is safe to use it if it got successfully compiled.
Regarding the standard library, another solution would be to install libstdc++
on your computer. It can be installed along with any recent version gcc
. If you are using Homebrew, just do brew install gcc
. If you are using some other package management system on MacOS (like MacPorts), there is the gcc package for sure.
If you have the libstdc++
library installed, please, try again to install PySAT from pip
and let me know what you get. I will need to see what else can be done if this does not help.
from pysat.
I did brew install gcc
and the two later warnings disappeared when I build from the source. However, I still get the same error when I install from pip. Thank you so much. :)
from pysat.
I am having the same issue regarding the missing cmath file. Any solutions yet? I have of course tried all the aforementioned solutions. Cheers!
from pysat.
Hi @acb16ua! Unfortunately, I cannot reproduce the issue on my laptop (i.e. with the latest MacOS). Can you confirm that changing the c++ library from "libstdc++" to "libc++" (see the comment on extra_compile_args
) fixes the problem in your case, as was reported by @moqingyan? If yes, I will update setup.py
accordingly.
from pysat.
Hi @moqingyan and @acb16ua. Could you, please, check if you can install the latest version of the toolkit from PyPI? I tried to address the issue you had. And hopefully it is gone now. For installing, simply do: $ [sudo] pip install -U --no-cache-dir python-sat
. If the problem is resolved, I will close the issue.
from pysat.
No, it still does not work for me. This is the error message:
XXX@XXX ~> pip install -U --no-cache-dir python-sat
Collecting python-sat
Downloading https://files.pythonhosted.org/packages/ff/5a/11c7113ac45425ef0cb9d2e4565b474984063a598ac5323ea3cf503889b6/python-sat-0.1.4.dev8.tar.gz (239kB)
100% |████████████████████████████████| 245kB 504kB/s
Collecting pypblib>=0.0.3 (from python-sat)
Downloading https://files.pythonhosted.org/packages/9f/90/28ef9f296fbeec06862f2c6f7c1e25ab3b536387173deeeaec129d2cd294/pypblib-0.0.3.tar.gz (73kB)
100% |████████████████████████████████| 81kB 6.4MB/s
Requirement already satisfied, skipping upgrade: six in ./anaconda3/lib/python3.7/site-packages (from python-sat) (1.12.0)
Installing collected packages: pypblib, python-sat
Running setup.py install for pypblib ... error
Complete output from command /PATH/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/m9/rxccw5rj4tz7d8h2lqp051rm0000gn/T/pip-install-zxk59b_7/pypblib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/m9/rxccw5rj4tz7d8h2lqp051rm0000gn/T/pip-record-xpofw72q/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/pypblib
copying pypblib/init.py -> build/lib.macosx-10.7-x86_64-3.7/pypblib
running build_ext
building 'pypblib.pblib' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/Modules
creating build/temp.macosx-10.7-x86_64-3.7/Modules/pblib
creating build/temp.macosx-10.7-x86_64-3.7/External
creating build/temp.macosx-10.7-x86_64-3.7/External/pblib
creating build/temp.macosx-10.7-x86_64-3.7/External/pblib/encoder
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jianihuang/anaconda3/include -arch x86_64 -I/Users/jianihuang/anaconda3/include -arch x86_64 -IExternal/pblib -IModules/pblib -I/Users/jianihuang/anaconda3/include/python3.7m -c Modules/pblib/pblib_incpbconstraint.cpp -o build/temp.macosx-10.7-x86_64-3.7/Modules/pblib/pblib_incpbconstraint.o -std=c++11
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
Modules/pblib/pblib_incpbconstraint.cpp:4:10: fatal error: 'sstream' file not found
#include
^~~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/PATH/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/m9/rxccw5rj4tz7d8h2lqp051rm0000gn/T/pip-install-zxk59b_7/pypblib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/m9/rxccw5rj4tz7d8h2lqp051rm0000gn/T/pip-record-xpofw72q/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/m9/rxccw5rj4tz7d8h2lqp051rm0000gn/T/pip-install-zxk59b_7/pypblib/
from pysat.
Hi @moqingyan. The authors of pypblib have already addressed this issue in the new version of their library. Please, try to install PySAT again. The installer of PySAT will hopefully make an attempt to install the newest version of pypblib (0.0.4) as a dependency, which should fix the issue.
from pysat.
Hi @moqingyan and @acb16ua, is there any news? Should I close the issue?
from pysat.
Hi @alexeyignatiev, I think I'm facing the same problem:
core/Solver.cc:21:18: fatal error: math.h: No such file or directory
#include <math.h>
^
....
gcc: error: unrecognized command line option ‘--stdlib=libc++’
error: command 'gcc' failed with exit status 1
from pysat.
After executing CC=/usr/bin/clang I get another error (see attachment).
error.txt
from pysat.
Hi @fedetoff. My understanding is that the problem is the same in both cases (missing "math.h"
). Do you know where it is located on your system? What happens if you add the path to it manually (for example, by editing setup.py
)?
from pysat.
Guys, if you want this fixed, this discussion should be alive. I wish I could guess myself what happens on your systems and why, but I cannot, sorry. So, in order to correct the problem and forget about it, more input is needed from you.
from pysat.
Hi @alexeyignatiev, I've switched to Python 3.7 and now it works.
from pysat.
Have similar problems with installing python-sat. Any ideas?
Find attached the error message.
error.txt
from pysat.
Hi @wphun1, thank you for letting me know. Could you tell me what is the OS+version you are using? Also, what does the command
python -c 'import platform; print(platform.system())'
report? As far as I understand, you are using MacOS and the installer correctly decides to replace libstdc++
with libc++
.
The installation log is cryptic. According it, the linker does not use -lstdc++
and then it complains about -lstdc++
for some reason. As far as I can see, it actually uses -lc++
:
g++ -bundle -undefined dynamic_lookup -L/usr/local/anaconda3/lib -arch x86_64 -L/usr/local/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/cardenc/pycard.o -lc++ -o build/lib.macosx-10.7-x86_64-3.7/pycard.cpython-37m-darwin.so
Is the log complete?
from pysat.
I am using macOS Mojave 10.14.5.
python -c 'import platform; print(platform.system())'
Darwin
The log was not complete.
Here the entire log!
error.txt
from pysat.
Thanks! Is my understanding correct that it fails to install pypblib
? Can you try to install it first?
pip install --no-cache-dir pypblib
from pysat.
Does not work unfortunately...
error.txt
from pysat.
OK, thanks. This seems to be the culprit. You can still try to install PySAT by cloning the repository and doing the following inside:
- remove the dependency to pypblib in
setup.py
(see line 118) - do
pip install -e .
If this works, then you can use PySAT, but there will be no support for PB encodings. If this still fails, then there is another installation problem, with PySAT itself.
from pysat.
Seems to be another problem?
error.txt
from pysat.
Well, it seems to be exactly the same issue but this time it arises when you compile PySAT. Unfortunately, I fail to understand it (at least for now). The linker complains about -lstdc++
being missing but it does not use this flag in the command:
g++ -bundle -undefined dynamic_lookup -L/usr/local/anaconda3/lib -arch x86_64 -L/usr/local/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/cardenc/pycard.o -lc++ -o build/lib.macosx-10.7-x86_64-3.7/pycard.cpython-37m-darwin.so
What compiler is that?
from pysat.
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Hope this helps.
from pysat.
Thanks! Mine is exactly the same. Not sure why it fails in your case, sorry. I will need to think about this.
from pysat.
Thank you! Sry, that I am not much of a help in finding a way to solve this...
from pysat.
Hi all,
I have finally managed to create a binary wheel for the toolkit for MacOS. This means you do not have to compile PySAT on your Apple machine as it should come precompiled on MacOS. So simply doing:
$ pip install -U python-sat[aiger]
should do the trick. Don't forget to prepend the command with sudo
if necessary.
from pysat.
I meet the similar questions when I tried to install the package from both pip
/root/anaconda3/envs/LENSR/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -fPIC -Isolvers -I/root/anaconda3/envs/LENSR/include/python3.7m -c solvers/pysolvers.cc -o build/temp.linux-x86_64-3.7/solvers/pysolvers.o -std=c++11 -Wall -Wno-deprecated -DWITH_CADICAL -DWITH_GLUCOSE30 -DWITH_GLUCOSE41 -DWITH_LINGELING -DWITH_MAPLECHRONO -DWITH_MAPLECM -DWITH_MAPLESAT -DWITH_MINICARD -DWITH_MINISAT22 -DWITH_MINISATGH cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ In file included from solvers/glucose30/utils/Options.h:30:0, from solvers/glucose30/core/Solver.h:35, from solvers/pysolvers.cc:25: solvers/glucose30/utils/ParseUtils.h:28:10: fatal error: zlib.h: No such file or directory #include <zlib.h> ^~~~~~~~ compilation terminated. error: command '/root/anaconda3/envs/LENSR/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /root/anaconda3/envs/LENSR/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-96abmeo5/python-sat/setup.py'"'"'; __file__='"'"'/tmp/pip-install-96abmeo5/python-sat/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-nxvngpt2/install-record.txt --single-version-externally-managed --compile --install-headers /root/anaconda3/envs/LENSR/include/python3.7m/python-sat Check the logs for full command output.
Besides, when I tried the Github Vesion, it reported
building 'pysolvers' extension /root/anaconda3/envs/LENSR/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -fPIC -Isolvers -I/root/anaconda3/envs/LENSR/include/python3.7m -c solvers/pysolvers.cc -o build/temp.linux-x86_64-3.7/solvers/pysolvers.o -std=c++11 -Wall -Wno-deprecated -DWITH_CADICAL -DWITH_GLUCOSE30 -DWITH_GLUCOSE41 -DWITH_LINGELING -DWITH_MAPLECHRONO -DWITH_MAPLECM -DWITH_MAPLESAT -DWITH_MINICARD -DWITH_MINISAT22 -DWITH_MINISATGH cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ solvers/pysolvers.cc:21:10: fatal error: cadical/cadical.hpp: No such file or directory #include "cadical/cadical.hpp" ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. error: command '/root/anaconda3/envs/LENSR/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
My platform is ubuntu 16.04 LTS
python = 3.7.1
conda = 4.8.1
pypblib = 0.0.4
from pysat.
Hi @cheunglei,
Can you double-check whether or not your Ubuntu system has the zlib1g-dev
package installed? It is required for successful solver compilation. I guess the proper way would be to disable this dependency. I will consider doing it in the future. But for now, you have to make sure it is installed.
Regarding your second attempt, I am not sure what happened. The best solution would be to try again because you might have a network issue and so some of the solver files were not downloaded.
Best,
Alexey
from pysat.
Thanks for your reply. Yes, I do have a network issue at first, and I have handled it now. I am sure that I have installed zlib1g-dev
both in my Ubuntu and virtual environment, because I can compile a test code
#include <zlib.h> #include <stdio.h> int main(){ printf("hello world"); return 0; }
with gcc
command in normal environment and conda
virtual environment.
I think the reason is that x86_64-conda_cos6-linux-gnu-cc
can not find the zlib.h
. But I don not know how to deal with it.
from pysat.
When I add -I./zlib
in cmd x86_64-conda_cos6-linux-gnu-cc
, it can find the zlib.h,
but another error occurred ./zlib/unistd.h:10:10: fatal error: io.h: No such file or directory #include <io.h> ^~~~~~ compilation terminated.
. I guess there is a bug in the code of installing the 'python-sat' to the Ubuntu.
from pysat.
Hi @cheunglei,
There should not be a bug like that in the installer of PySAT. Well, not that I know of at least. The include directory you are adding manually is a wrong one. It is used for installing the toolkit on Windows -- not on Linux. So discard it.
If you really have zlib1g-dev
installed on your machine, you need to find where it is installed. Afterwards, we need to understand why your compiler does not see it.
Also, I should say that the installer was tested with the standard compiler. BTW, why do you use x86_64-conda_cos6-linux-gnu-cc
?
Alexey
from pysat.
Thanks @alexeyignatiev ,
Here is the results of whereis zlib
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz
and here is the search path of my x86_64-conda_cos6-linux-gnu-cc
install: /root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/
programs: =/root/anaconda3/envs/LENSR/bin/../libexec/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/:/root/anaconda3/envs/LENSR/bin/../libexec/gcc/:/root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/bin/x86_64-conda_cos6-linux-gnu/7.2.0/:/root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/bin/
libraries: =/root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/:/root/anaconda3/envs/LENSR/bin/../lib/gcc/:/root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/lib/x86_64-conda_cos6-linux-gnu/7.2.0/:/root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/lib/../lib/:/root/anaconda3/envs/LENSR/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib/x86_64-conda_cos6-linux-gnu/7.2.0/:/root/anaconda3/envs/LENSR/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib/../lib/:/root/anaconda3/envs/LENSR/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/x86_64-conda_cos6-linux-gnu/7.2.0/:/root/anaconda3/envs/LENSR/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/../lib/:/root/anaconda3/envs/LENSR/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/lib/:/root/anaconda3/envs/LENSR/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib/:/root/anaconda3/envs/LENSR/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/
Is it that I should add the /usr/include
to its search path? I do not know why x86_64-conda_cos6-linux-gnu-cc
is used; it is called by the install code automatically. Maybe something goes wrong with my conda
?
from pysat.
OK, now let's see what happens if you add '/usr/include'
to the lists include_dirs
of setup.py
(there are two of these parameters needed for the compilation of submodules card
and solvers
).
Here I mean the github version of the toolkit. Once the directory is added to the include lists, try to do $ python setup.py build
. If it succeeds, you can proceed with the installation. Otherwise, we need to try harder.
from pysat.
@alexeyignatiev Thanks!
YES! After I added '/usr/include' to the lists include_dirs of setup.py, it succeeded. Thank you again!
from pysat.
(base) C:\Users\ASUS>pip install python-sat
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: python-sat in d:\anaconda3\lib\site-packages (0.1.5.dev16)
Requirement already satisfied: six in d:\anaconda3\lib\site-packages (from python-sat) (1.14.0)
I install python-sat successfully, however, when I input the following code
from pysat.solvers import Glucose3
g = Glucose3()
g.add_clause([-1, 2])
g.add_clause([-2, 3])
print(g.solve())
print(g.get_model())
in the pycharm, the error will arise
D:\anaconda3\envs\pytorch\python.exe D:/PycharmProjects/test/satproblem.py
Traceback (most recent call last):
File "D:/PycharmProjects/test/satproblem.py", line 1, in
from pysat.solvers import Glucose3
File "D:\anaconda3\envs\pytorch\lib\site-packages\pysat\solvers.py", line 144, in
import pysolvers
ImportError: DLL load failed: The specified module cannot be found
code:
from pysat.card import *
cnf = CardEnc.atmost(lits=[1, 2, 3], encoding=EncType.pairwise)
print(cnf.clauses)
error:
D:\anaconda3\envs\pytorch\python.exe D:/PycharmProjects/test/satproblem.py
Traceback (most recent call last):
File "D:/PycharmProjects/test/satproblem.py", line 1, in
from pysat.card import *
File "D:\anaconda3\envs\pytorch\lib\site-packages\pysat\card.py", line 99, in
import pycard
ImportError: DLL load failed: The specified module cannot be found
win10, pycharm, python 3.7.6, python-sat 0.1.5.dev16
from pysat.
Well, it looks like it is not installed properly. Can you reinstall the toolkit, e.g. using $ pip uninstall python-sat
followed by $ pip install --no-cache-dir python-sat
? Alternatively, there might be a problem with the paths setup.
from pysat.
Hi @alexeyignatiev ,I did it the way you did, but still the same problem.
from pysat.
OK, according to your original message, the toolkit is installed in d:\anaconda3\lib\site-packages
. If this is the case, what happens if you run your script from that directory?
from pysat.
The point is that the C extensions should be there, called pysolvers.*
and pycard.*
. Can you confirm you have the files there?
from pysat.
I doesn't have the file
from pysat.
If I run pb.py in the D:\anaconda3\Lib\site-packages\pysat,
Testing started at 10:59 ...
D:\anaconda3\python.exe "D:\JetBrains\PyCharm Community Edition 2020.1.2\plugins\python-ce\helpers\pycharm\docrunner.py" D:/anaconda3/Lib/site-packages/pysat/pb.py
Traceback (most recent call last):
File "D:\JetBrains\PyCharm Community Edition 2020.1.2\plugins\python-ce\helpers\pycharm\docrunner.py", line 305, in
modules = [loadSource(a[0])]
File "D:\JetBrains\PyCharm Community Edition 2020.1.2\plugins\python-ce\helpers\pycharm\docrunner.py", line 237, in loadSource
module = _load_file(moduleName, fileName)
File "D:\JetBrains\PyCharm Community Edition 2020.1.2\plugins\python-ce\helpers\pycharm\docrunner.py", line 209, in _load_file
return machinery.SourceFileLoader(moduleName, fileName).load_module()
File "", line 407, in _check_name_wrapper
File "", line 907, in load_module
File "", line 732, in load_module
File "", line 265, in _load_module_shim
File "", line 696, in _load
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "D:/anaconda3/Lib/site-packages/pysat/pb.py", line 113, in
class EncType(object):
File "D:/anaconda3/Lib/site-packages/pysat/pb.py", line 148, in EncType
best: pblib.PB_BEST,
NameError: name 'pblib' is not defined
Process finished with exit code 1
from pysat.
OK, it means that either it is installed in a different directory, or it is not installed at all. What does $ pip show python-sat
say? It should show the location. If there is one, try to go there and check the existence of the files. Afterwards, if the files are present, try doing python -c "import pysolvers; import pycard"
to see if that would complain.
from pysat.
(base) C:\Users\ASUS>pip show python-sat
Name: python-sat
Version: 0.1.5.dev16
Summary: A Python library for prototyping with SAT oracles
Home-page: https://github.com/pysathq/pysat
Author: Alexey Ignatiev, Joao Marques-Silva, Antonio Morgado
Author-email: [email protected], [email protected], [email protected]
License: MIT
Location: d:\anaconda3\lib\site-packages
Requires: six
Required-by:
In the d:\anaconda3\lib\site-packages, there are "solvers.py, pb.py, formula.py, card.py, _utils.py, _fileio.py, init.py"
(base) C:\Users\ASUS>python -c "import pysolvers; import pycard"
Traceback (most recent call last):
File "", line 1, in
ImportError: DLL load failed: The specified module cannot be found
from pysat.
Strange. When you installing it, does the installer grab the precompiled library or does it try to compile it on your machine? Can you show me what pip install --force-reinstall --no-cache-dir python-sat
prints to stdout?
from pysat.
You can also try to manually put the contents of this zip file in that directory and see if that solves your problem.
from pysat.
(base) C:\Users\ASUS>pip install --force-reinstall --no-cache-dir python-sat Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting python-sat Downloading https://pypi.tuna.tsinghua.edu.cn/packages/71/09/14ab9aecdebb2fd87d33fa68f49571a29d7fb0fe95a7199857977bb3e6e0/python_sat-0.1.5.dev16-cp37-cp37m-win_amd64.whl (727 kB) |████████████████████████████████| 727 kB 731 kB/s Collecting six Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl (10 kB) ERROR: pytest-astropy 0.8.0 requires pytest-cov>=2.0, which is not installed. ERROR: pytest-astropy 0.8.0 requires pytest-filter-subpackage>=0.1, which is not installed. ERROR: astroid 2.3.3 requires typed-ast<1.5,>=1.4.0; implementation_name == "cpython" and python_version < "3.8", which is not installed. Installing collected packages: six, python-sat Attempting uninstall: six Found existing installation: six 1.15.0 Uninstalling six-1.15.0: Successfully uninstalled six-1.15.0 Attempting uninstall: python-sat Found existing installation: python-sat 0.1.5.dev16 Uninstalling python-sat-0.1.5.dev16: Successfully uninstalled python-sat-0.1.5.dev16 Successfully installed python-sat-0.1.5.dev16 six-1.15.0
from pysat.
You can also try to manually put the contents of this zip file in that directory and see if that solves your problem.
I put the file pycard.cp37-win_amd64.pyd
and pysolvers.cp37-win_amd64.pyd
in D:\anaconda3\Lib\site-packages\pysat
, however, error still exists
from pysat.
Same error or another error? It is hard to guess here. What does the following say?
$ cd D:/anaconda3/Lib/site-packages/
$ python -c "import pysolvers; import pycard"
from pysat.
(base) D:\anaconda3\Lib\site-packages>python -c "import pysolvers; import pycard"
Traceback (most recent call last):
File "", line 1, in
ImportError: DLL load failed: The specified module cannot be found
from pysat.
You put the files in a wrong directory. It should be D:\anaconda3\Lib\site-packages
instead of D:\anaconda3\Lib\site-packages\pysat
. Afterwards, go to D:\anaconda3\Lib\site-packages
and check.
from pysat.
You put the files in a wrong directory. It should be
D:\anaconda3\Lib\site-packages
instead ofD:\anaconda3\Lib\site-packages\pysat
. Afterwards, go toD:\anaconda3\Lib\site-packages
and check.
I put the file pycard.cp37-win_amd64.pyd and pysolvers.cp37-win_amd64.pyd in D:\anaconda3\Lib\site-packages, but this method does not work,
(base) D:\anaconda3\Lib\site-packages>python -c "import pysolvers; import pycard" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: DLL load failed: The specified module cannot be found
from pysat.
This code can run
from pysat.formula import CNF pos = CNF(from_clauses=[[-1, 2], [3]]) neg = pos.negate() print(neg.clauses)
output:
D:\anaconda3\python.exe D:/PycharmProjects/test/satproblem.py [[1, -4], [-2, -4], [-1, 2, 4], [4, -3]]
from pysat.formula import CNF cnf1 = CNF() cnf1.from_string('p cnf 2 2\n-1 2 0\n1 -2 0') print(cnf1.clauses) cnf2 = CNF(from_string='p cnf 3 3\n-1 2 0\n-2 3 0\n-3 0\n') print(cnf2.clauses) print(cnf2.nv)
output:
D:\anaconda3\python.exe D:/PycharmProjects/test/satproblem.py [[-1, 2], [1, -2]] [[-1, 2], [-2, 3], [-3]] 3
However,
from pysat.card import * cnf = CardEnc.atmost(lits=[1, 2, 3], encoding=EncType.pairwise) print(cnf.clauses)
output:
D:\anaconda3\python.exe D:/PycharmProjects/test/satproblem.py Traceback (most recent call last): File "D:/PycharmProjects/test/satproblem.py", line 1, in <module> from pysat.card import * File "D:\anaconda3\lib\site-packages\pysat\card.py", line 99, in <module> import pycard ImportError: DLL load failed: The specified module cannot be found
from pysat.pb import * cnf = PBEnc.atmost(lits=[1, 2, 3], weights=[1, 2, 3], bound=3) print(cnf.clauses)
output:
D:\anaconda3\python.exe D:/PycharmProjects/test/satproblem.py Traceback (most recent call last): File "D:/PycharmProjects/test/satproblem.py", line 1, in <module> from pysat.pb import * File "D:\anaconda3\lib\site-packages\pysat\pb.py", line 113, in <module> class EncType(object): File "D:\anaconda3\lib\site-packages\pysat\pb.py", line 148, in EncType best: pblib.PB_BEST, NameError: name 'pblib' is not defined
from pysat.solvers import Glucose3, Solver s = Solver(name='g4') s.add_clause([-1, 2]) s.add_clause([-1, -2]) s.solve() print(s.get_model())
output:
D:\anaconda3\python.exe D:/PycharmProjects/test/satproblem.py Traceback (most recent call last): File "D:/PycharmProjects/test/satproblem.py", line 1, in <module> from pysat.solvers import Glucose3, Solver File "D:\anaconda3\lib\site-packages\pysat\solvers.py", line 144, in <module> import pysolvers ImportError: DLL load failed: The specified module cannot be found
from pysat.
Yes, none of the C extensions is working on your machine. Not sure why. The pure-python modules are working fine, which is not surprising.
from pysat.
Yes, none of the C extensions is working on your machine. Not sure why. The pure-python modules are working fine, which is not surprising.
Could you please tell me which kind of C extension should I install? Thank you so much!
from pysat.
Hi @zero123456. What I meant is that your system fails to see the C extensions that are already shipped with the Python package, i.e. pysolvers
and pycard
-- they are crucial for the operation of PySAT. I have no clue why this happens. It would be great to have a Windows machine to try using PySAT, at some point.
from pysat.
Any chance pypblib wheels can be built and hosted somewhere for Windows?
MSVC 2019 gets errors on the "constant" keyword:
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Gregory\\AppData\\Local\\Temp\\pip-install-quio7mm9\\pypblib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Gregory\\AppData\\Local\\Temp\\pip-install-quio7mm9\\pypblib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Gregory\AppData\Local\Temp\pip-record-_9184cc4\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files\python38\Include\pypblib'
cwd: C:\Users\Gregory\AppData\Local\Temp\pip-install-quio7mm9\pypblib\
Complete output (33 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pypblib
copying pypblib\__init__.py -> build\lib.win-amd64-3.8\pypblib
running build_ext
building 'pypblib.pblib' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\Modules
creating build\temp.win-amd64-3.8\Release\Modules\pblib
creating build\temp.win-amd64-3.8\Release\External
creating build\temp.win-amd64-3.8\Release\External\pblib
creating build\temp.win-amd64-3.8\Release\External\pblib\encoder
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IExternal\pblib -IModules/pblib "-Ic:\program files\python38\include" "-Ic:\program files\python38\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /TpModules/pblib\aux_var_manager.cpp /Fobuild\temp.win-amd64-3.8\Release\Modules/pblib\aux_var_manager.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
aux_var_manager.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IExternal\pblib -IModules/pblib "-Ic:\program files\python38\include" "-Ic:\program files\python38\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /TpModules/pblib\helper.cpp /Fobuild\temp.win-amd64-3.8\Release\Modules/pblib\helper.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
helper.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IExternal\pblib -IModules/pblib "-Ic:\program files\python38\include" "-Ic:\program files\python38\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /TpModules/pblib\pblib_incpbconstraint.cpp /Fobuild\temp.win-amd64-3.8\Release\Modules/pblib\pblib_incpbconstraint.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
pblib_incpbconstraint.cpp
External\pblib\pbconstraint.h(53): error C2059: syntax error: 'constant'
External\pblib\pbconstraint.h(54): error C2059: syntax error: 'constant'
External\pblib\pbconstraint.h(55): error C2059: syntax error: 'constant'
C:\Users\Gregory\AppData\Local\Temp\pip-install-quio7mm9\pypblib\External\pblib\SimplePBConstraint.h(29): error C2059: syntax error: 'constant'
C:\Users\Gregory\AppData\Local\Temp\pip-install-quio7mm9\pypblib\External\pblib\SimplePBConstraint.h(30): error C2059: syntax error: 'constant'
Modules/pblib\pblib_incpbconstraint.cpp(48): warning C4244: 'argument': conversion from 'int64_t' to 'long', possible loss of data
Modules/pblib\pblib_incpbconstraint.cpp(47): warning C4244: 'argument': conversion from 'int64_t' to 'long', possible loss of data
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Gregory\\AppData\\Local\\Temp\\pip-install-quio7mm9\\pypblib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Gregory\\AppData\\Local\\Temp\\pip-install-quio7mm9\\pypblib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Gregory\AppData\Local\Temp\pip-record-_9184cc4\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files\python38\Include\pypblib' Check the logs for full command output.
Sure I could put GCC for Windows and launch a command prompt with that build environment but it seems strange this stuff would not be resolved.
from pysat.
Well, you may want to ask the authors of PyPBLib about this. It is a third-party library - not ours. Also, as far as I know, the wheels for PyPBLib should exist -- rjungbeck was kind enough to make them for Windows. On Windows, they should be installed by pip
together with PySAT's binary wheel, which is also available. Alternatively, you can download the wheels for PyPBLib manually from
py3.6
py3.7
py3.8
and try to install them.
from pysat.
Well, you may want to ask the authors of PyPBLib about this.
Thanks for your response and the info. The reason I ask is it seems there is very little about PyPBLIB on the web - it seems this project is the only major one to use it. Even the repo is locked behind a custom GitLab login not that the source can't be fetched from PyPI. Anyway could not find these and I appreciate your help. The wheel worked easily :D
from pysat.
Hi, when i am installing the python-sat 0.1.5.dev1 (I am using Windows) from PyCharm, i have this problem:
ERROR: Command errored out with exit status 1:
command: 'C:\Users\comrade\PycharmProjects\pythonProject1\ven\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\comrade\AppData\Local\Temp\pip-install-gkop4l9u\python-sat_afe03412ca054ef6af78152de2bcfbed\setup.py'"'"'; file='"'"'C:\Users\comrade\AppData\Local\Temp\pip-install-gkop4l9u\python-sat_afe03412ca054ef6af78152de2bcfbed\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\comrade\AppData\Local\Temp\pip-pip-egg-info-qcxsndo7'
cwd: C:\Users\comrade\AppData\Local\Temp\pip-install-gkop4l9u\python-sat_afe03412ca054ef6af78152de2bcfbed
Complete output (9 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\comrade\AppData\Local\Temp\pip-install-gkop4l9u\python-sat_afe03412ca054ef6af78152de2bcfbed\setup.py", line 126, in
with chdir(solver):
File "C:\Users\comrade\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 117, in enter
return next(self.gen)
File "C:\Users\comrade\AppData\Local\Temp\pip-install-gkop4l9u\python-sat_afe03412ca054ef6af78152de2bcfbed\setup.py", line 42, in chdir
os.chdir(new_dir)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'cadical'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/11/77/6783d52283582550582c731eb727511fec90b57b03d0d0c22f1ca9d9025d/python-sat-0.1.5.dev1.tar.gz#sha256=83d324aecadfa6afa92320bb36912ba251ded10b66241754cb5a9eb0d4448fe5 (from https://pypi.org/simple/python-sat/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement python-sat==0.1.5.dev1
ERROR: No matching distribution found for python-sat==0.1.5.dev1
And if I am installing 0.1.6.dev9 version, I have https://pastebin.com/ktL86THC.
May be I am doing something wrong? Any advices?
from pysat.
OK, I have a couple of comments. First, is there any particular reason for not using the latest version of the toolkit? Second, what is exactly the system you are using? Currently, we have precompiled binary wheels for Windows with Python 3.6, 3.7, and 3.8. You don't have to compile anything if you are using one of these.
from pysat.
Thanks for replying, I am installed Python 3.8 (I am used 3.9 before) and error disappeared.
from pysat.
Great to know that it works!
from pysat.
@ImnotHerewell BTW, I have just uploaded a precompiled binary wheel for Windows with Py39. You should be able to use it as well.
from pysat.
@ImnotHerewell BTW, I have just uploaded a precompiled binary wheel for Windows with Py39. You should be able to use it as well.
Seriously? Wow, thank you!
from pysat.
Hi ! I have a probleme when I do "python setup.py install" command. [Errno 13]
error: can't create or remove files in install directory
preparing cadical
not downloading solvers/cadical.tar.gz since it exists locally
extracting solvers/cadical.tar.gz
False cadical-rel-1.0.3 cadical
adapting cadical's files
patching cadical
(Stripping trailing CRs from patch; use --binary to disable.)
patching file solvers/cadical/Makefile
...
...
(Stripping trailing CRs from patch; use --binary to disable.)
patching file solvers/minisatgh/utils/System.h
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-6940.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
variable.
I still can't use this module. Could you help me please ?
from pysat.
Hi @Cengokill. Try to install it from PyPI. See the installation page for details.
from pysat.
Hi @Cengokill. Try to install it from PyPI. See the installation page for details.
Is it working on Windows ?
from pysat.
It should work on some of the versions.
from pysat.
Related Issues (20)
- Unexpected MaxSat Solution from `RC2` HOT 3
- Error when reading a CNF formula from file HOT 8
- pep 517 error HOT 5
- Unused variables do not occur in model HOT 11
- Extracting learned clauses (during a search) HOT 4
- Docs: `BeyondNP` link is broken HOT 2
- Obtaining cores with solve_limited HOT 2
- How to use a custom SAT solver within PySAT? HOT 1
- Incorrect sign convention in CryptoMinisat core HOT 2
- Release version mismatch between pypi and github HOT 4
- Very slow useless (?) deepcopy in from_clauses HOT 4
- Clausification of nested Implication fails HOT 15
- Method to get list of clauses after propagation? HOT 2
- Atom constructor reuses wrong object from store HOT 2
- Retrieve partial solution HOT 1
- MUS extraction unsupported for CNF with either OptUX and MUSx ? HOT 2
- (p ↔ p) simplifies to p HOT 6
- simplified fails with XOr HOT 6
- solve returns false, but the formula is satisfiable HOT 6
- `ITotalizer` does not accept an `IDPool HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysat.