How to install spacy-hunspell on MacOS - python

When I run pip3 install hunspell==0.5.0, it seemingly installs without a hitch.
Collecting hunspell==0.5.0
Installing collected packages: hunspell
Successfully installed hunspell-0.5.0
Now, once I run pip3 install spacy-hunspell it seemingly installs as well.
Installing collected packages: spacy-hunspell
Successfully installed spacy-hunspell-0.1.0
However, once I open my project and import the package, I get:
Traceback (most recent call last):
File "genVocab.py", line 5, in <module>
from spacy_hunspell import spaCyHunSpell
File "/usr/local/lib/python3.7/site-packages/spacy_hunspell/__init__.py", line 5, in <module>
from hunspell import HunSpell
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/hunspell.cpython-37m-darwin.so, 2): Symbol not found: __ZN8Hunspell14add_with_affixERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_
Referenced from: /usr/local/lib/python3.7/site-packages/hunspell.cpython-37m-darwin.so
Expected in: flat namespace
in /usr/local/lib/python3.7/site-packages/hunspell.cpython-37m-darwin.so
I've tried building hunspell, pyhunspell, and spacy-hunspell each from their source repos with different compiler flags and versions of GCC, but the problem persists.
Any idea how to move forward from here?

Related

(UPDATED) psycopg2 [Import Error] on Windows - ImportError: dynamic module does not define module export function (PyInit__psycopg)

[UPDATE] - An antivirus software installed on my computer was causing the issue. Disabling it solved the problem :)
I'm getting a weird error when I try to import psycopg2.
Using Python 3.7.7
Downloaded psycopg2 using pip
$ python -m pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.8.5-cp37-cp37m-win_amd64.whl (1.1 MB)
Installing collected packages: psycopg2
Successfully installed psycopg2-2.8.5
import psycopg2
if name =="main":
print("Hello World!")
Running the code gives me the below error:
$ python test2.py Traceback (most recent call last): File "test2.py", line 1, in <module>
import psycopg2
File "C:\Users\blah\AppData\Local\Programs\Python\Python37\lib\site-packages\psycopg2\__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa ImportError: dynamic module does not define module export function (PyInit__psycopg)
Have tried installing pscopg2-binary instead. Still getting the same error.
Any idea?

No module named 'MySQLdb' after installing mysqlclient

I am using PyCharm and I'm trying to make a simple script that connects to a database.
In the PyCharm terminal, both mysqlclient installations from here seem to fail.
(venv) C:\Users\erics\CS261>pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
(venv) C:\Users\erics\CS261>pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
mysqlclient-1.4.6-cp38-cp38-win32.whl is not a supported wheel on this platform.
In Windows's terminal, they are succesfully installed:
C:\Users\erics>pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
Processing c:\users\erics\mysqlclient-1.4.6-cp38-cp38-win32.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6
Even though it is "succesfully installed", my script does not seem to run...
C:\Users\erics\CS261\venv\Scripts\python.exe C:/Users/erics/CS261/venv/Scripts/test.py
Traceback (most recent call last):
File "C:/Users/erics/CS261/venv/Scripts/test.py", line 1, in <module>
import MySQLdb
ModuleNotFoundError: No module named 'MySQLdb'
Process finished with exit code 1

Issue importing psycopg2 after installing from local archives (in order to specify pg_config path in setup.cfg)

I am trying to install and use psycopg2, using Python on Mac OS. After running into issue with install due to "pg_config not found" error, I downloaded source files and specified pg_config path in setup.cfg. Installation was successful but now psycopg2 encounters an error when imported.
Install
pip install /Users/k/Downloads/psycopg2-2.8.3
Processing ./Downloads/psycopg2-2.8.3
Installing collected packages: psycopg2
Running setup.py install for psycopg2: started
Running setup.py install for psycopg2: finished with status 'done'
Successfully installed psycopg2-2.8.3
Import error
import psycopg2
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so, 2): Library not loaded: libssl.1.1.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so
Reason: image not found
Any help would be greatly appreciated!
If me, I would rather do it as follows:
$ pip install pipenv --user
$ pipenv shell
$ pipenv install psycopg2==2.8.3
$ python
>>> import psycopg2

Can't correctly import six module via pip when I was installing easy install

it has already claimed that I have either installed or upgraded six module
C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1>pip install --upgrade six
Requirement already up-to-date: six in c:\users\floatsd\anaconda3\lib\site-packages
but it shows error run the easy_install.py
C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1>python easy_install.py
and it returns:
Traceback (most recent call last):
File "easy_install.py", line 4, in <module>
from setuptools.command.easy_install import main
File "C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1\setuptools\__init__.py", line 10, in <module>
from six.moves import filter, map
ImportError: No module named six.moves
p.s. my pip version is 9.0.1
I tried uninstall and install six again, but still doesn't work
C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1>pip uninstall six
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.10.0:
c:\users\floatsd\anaconda3\lib\site-packages\six-1.10.0-py3.5.egg-info
Proceed (y/n)? y
Successfully uninstalled six-1.10.0
C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1>pip install six
Collecting six
Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.10.0
C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1>python easy_install.py
Traceback (most recent call last):
File "easy_install.py", line 4, in <module>
from setuptools.command.easy_install import main
File "C:\Users\floatSD\Downloads\setuptools-34.3.1\setuptools-34.3.1\setuptools\__init__.py", line 10, in <module>
from six.moves import filter, map
ImportError: No module named six.moves

Python 2.7 Bloomberg blpapi import error on Mac OS X Sierra

After successful installation of the pybgg, when tried to run
$python test_pybbg.py
Got the following error message:
ImportError: No module named blpapi
MacBook:pfinance Allen$ which python
/Users/Allen/anaconda/bin/python
MacBook:pfinance Allen$ python test_pybbg.py
Traceback (most recent call last):
File "test_pybbg.py", line 2, in
import pybbg
File "/Users/Allen/anaconda/lib/python2.7/site-packages/pybbg/init.py", line 8, in
from .pybbg_k import Pybbg
File "/Users/Allen/anaconda/lib/python2.7/site-packages/pybbg/pybbg_k.py", line 8, in
import blpapi
ImportError: No module named blpapi
I used $pip list, but failed to see blpapi from the output list.
Any suggestions on how to fix my problem?
Thanks in advance
Ps. The followings show my installation log
MacBook:pfinance Allen$ pip install git+https://github.com/hubertrogers/pybbg
Collecting git+https://github.com/hubertrogers/pybbg
Cloning https://github.com/hubertrogers/pybbg to /private/var/folders/c6/7s88m85x0fj7l0zc52y_kcbh0000gn/T/pip-XagRDz-build
Installing collected packages: pybbg
Running setup.py install for pybbg ... done
Successfully installed pybbg-0.0.1
Based on the post I have set the library links properly;
MacBook:pfinance Allen$ echo $DYLD_LIBRARY_PATH
/Users/Allen/pfinance/blpapi_cpp_3.8.1.1/Darwin/
MacBook:pfinance Allen$ echo $BLPAPI_ROOT
/Users/Allen/pfinance/blpapi_cpp_3.8.1.1

Categories