|
From: Luigi B. <lui...@gm...> - 2020-08-13 17:41:53
|
>From inside Python, try import sys print(sys.path) The list you get should include /usr/local/lib/python3.8/site-packages, where pip3 installed QuantLib. If not, you might have some configuration to do. On Thu, Aug 13, 2020 at 7:09 PM Christofer Bogaso < bog...@gm...> wrote: > It would be better if I can load QuantLin with Python3. > > I failed to use some of the packages with Python2 (2.7.16) like > matplotlib. Thanks, > > On Thu, Aug 13, 2020 at 8:09 PM Javid Ashraff <jav...@ya...> > wrote: > >> I recall having the same problem in the past. Try using pip install >> rather than pip3 install. >> >> Regards, >> >> Javid >> >> On Thursday, 13 August 2020, 19:15:32 GMT+8, Christofer Bogaso < >> bog...@gm...> wrote: >> >> >> Thanks. >> >> I have reinstalled Python3 using brew. And then installed again the >> QuantLib as below - >> >> pip3 install QuantLib-Python >> >> Requirement already satisfied: QuantLib-Python in >> /usr/local/lib/python3.8/site-packages (1.18) >> >> Requirement already satisfied: QuantLib in >> /usr/local/lib/python3.8/site-packages (from QuantLib-Python) (1.19) >> >> After that I tried to import the library within Python3, but failed. >> >> >>> import QuantLib as ql >> >> Traceback (most recent call last): >> >> File "<stdin>", line 1, in <module> >> >> ModuleNotFoundError: No module named 'QuantLib' >> >> Any idea why is it failing? >> >> On Thu, Aug 13, 2020 at 4:36 PM Luigi Ballabio <lui...@gm...> >> wrote: >> >> I don't think there is. You'll probably have to remove the *build/bdist.macosx-10.15-x86_64/egg/ >> *directory. To be sure you're not missing anything, you might also run >> "pip uninstall QuantLib-Python" first, then look for anything related to >> QuantLib in /usr/local/lib and its Python subdirectories. Once you clean >> them (but be careful to only clean stuff with "quantlib" in its name), you >> can run "pip install" again. >> >> Luigi >> >> >> On Thu, Aug 13, 2020 at 12:00 PM Christofer Bogaso < >> bog...@gm...> wrote: >> >> Thanks Luigi. But, how can I clean that? Is there any specific syntax? >> >> On Thu, Aug 13, 2020 at 3:19 PM Luigi Ballabio <lui...@gm...> >> wrote: >> >> Hello, >> from the fact the traceback starts from " >> *build/bdist.macosx-10.15-x86_64/egg/"* and the fact it refers to >> */usr/local/lib/libQuantLib.0.dylib,* it looks to me like it's importing >> a version you tried to compile rather than the one you installed with pip. >> If that's the case, I'd try cleaning that one up. >> >> Hope this helps, >> Luigi >> >> >> On Thu, Aug 13, 2020 at 11:35 AM Christofer Bogaso < >> bog...@gm...> wrote: >> >> Hi, >> >> I wanted to run QuantLib from my Python workplace, however failed to >> import the library with below error - >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *>>> import QuantLibTraceback (most recent call last): File "<stdin>", >> line 1, in <module> File >> "build/bdist.macosx-10.15-x86_64/egg/QuantLib/__init__.py", line 24, in >> <module> File "build/bdist.macosx-10.15-x86_64/egg/QuantLib/QuantLib.py", >> line 13, in <module> File >> "build/bdist.macosx-10.15-x86_64/egg/QuantLib/_QuantLib.py", line 7, in >> <module> File "build/bdist.macosx-10.15-x86_64/egg/QuantLib/_QuantLib.py", >> line 6, in __bootstrap__ImportError: >> dlopen(/Users/aa/Library/Caches/Python-Eggs/QuantLib_Python-1.16.1-py2.7-macosx-10.15-x86_64.egg-tmp/QuantLib/_QuantLib.so, >> 2): Symbol not found: >> __ZN8QuantLib10IborCouponC1ERKNS_4DateEdS3_S3_jRKN5boost10shared_ptrINS_9IborIndexEEEddS3_S3_RKNS_10DayCounterEb >> Referenced from: >> /Users/aa/Library/Caches/Python-Eggs/QuantLib_Python-1.16.1-py2.7-macosx-10.15-x86_64.egg-tmp/QuantLib/_QuantLib.so >> Expected in: /usr/local/lib/libQuantLib.0.dylib in >> /Users/aa/Library/Caches/Python-Eggs/QuantLib_Python-1.16.1-py2.7-macosx-10.15-x86_64.egg-tmp/QuantLib/_QuantLib.so* >> >> I used the syntax *pip install QuantLib-Python* when I installed >> QuantLib, the installation appears to be successful. >> >> Any help will be highly appreciated. >> >> Thanks, >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |