geatpy-dev / geatpy

Evolutionary algorithm toolbox and framework with high performance for Python
http://www.geatpy.com
GNU Lesser General Public License v3.0
2.02k stars 726 forks source link

MacOs 10.15.5版本下内核函数无法加载 #135

Closed qizou97 closed 4 years ago

qizou97 commented 4 years ago

Describe the bug MacOs 10.15.5版本下通过pip安装geatpy 2.5.1会导致内核函数无法正常加载。

import geatpy as ea Traceback (most recent call last): File "", line 1, in File "/Users/s1zer/anaconda3/envs/ml/lib/python3.8/site-packages/geatpy/init.py", line 17, in from boundfix import boundfix ImportError: dlopen(/Users/s1zer/anaconda3/envs/ml/lib/python3.8/site-packages/geatpy/core/boundfix.cpython-38-darwin.so, 2): Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libgomp.1.dylib Referenced from: /Users/s1zer/anaconda3/envs/ml/lib/python3.8/site-packages/geatpy/core/boundfix.cpython-38-darwin.so Reason: image not found

image
geatpy-dev commented 4 years ago

@sizer74 我这边的mac10.14 python3.8测试正常。您的报错信息里面写到image not found似乎不是工具箱内抛出的异常。您试一下联系工作人员QQ1061655504看看能否远程协助解决,他已复工~

rubby33 commented 4 years ago

我这里遇到同样的问题,mac版本:10.14.2 安装方式 pip install geatpy。 应该不是个例,麻烦看下,多谢&辛苦啦

import geatpy as ea Traceback (most recent call last): File "", line 1, in File "/opt/anaconda3/envs/py3.7/lib/python3.7/site-packages/geatpy/init.py", line 17, in from boundfix import boundfix ImportError: dlopen(/opt/anaconda3/envs/py3.7/lib/python3.7/site-packages/geatpy/core/boundfix.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libgomp.1.dylib Referenced from: /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages/geatpy/core/boundfix.cpython-37m-darwin.so Reason: image not found

1061655504 commented 4 years ago

@rubby33 @sizer74 经过夜以继日的研究,已经研究出解决办法。mac终端执行以下命令:

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

brew update

brew install libomp

至此就可以在mac上import geatpy了。

rubby33 commented 4 years ago

@1061655504

辛苦了,所以解决方法是安装 brew install libomp?

我以前安装过libomp9,现在我升级到libomp10 貌似问题依旧,见下面的日志:

@sizer74 你用这种方法解决了吗?

` (py3.7) IT-C02YPCXVLVCF:build jonny$ brew upgrade libomp Updating Homebrew... ==> Upgrading 1 outdated package: libomp 9.0.0 -> 10.0.0 ==> Upgrading libomp 9.0.0 -> 10.0.0 ==> Downloading https://homebrew.bintray.com/bottles/libomp-10.0.0.mojave.bottle.tar.gz Already downloaded: /Users/jonny/Library/Caches/Homebrew/downloads/403cd581851b98bfc7e981a5442ee1c4bc057890e037db43d2067dfdb757dd16--libomp-10.0.0.mojave.bottle.tar.gz ==> Pouring libomp-10.0.0.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libomp/10.0.0: 9 files, 1.3MB Removing: /usr/local/Cellar/libomp/9.0.0... (9 files, 1.3MB) (py3.7) IT-C02YPCXVLVCF:build jonny$ pip install geatpy Collecting geatpy Using cached https://files.pythonhosted.org/packages/57/39/fcb7eeca67347c0e6b1b4b38c7e33446b2a8f026d0b4834b0fe2ff0c5ea1/geatpy-2.5.1-cp37-cp37m-macosx_10_9_x86_64.whl Requirement already satisfied: scipy>=1.0.0 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from geatpy) (1.4.1) Requirement already satisfied: matplotlib>=3.0.0 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from geatpy) (3.1.1) Requirement already satisfied: numpy>=1.17.0 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from geatpy) (1.18.1) Requirement already satisfied: python-dateutil>=2.1 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from matplotlib>=3.0.0->geatpy) (2.8.0) Requirement already satisfied: kiwisolver>=1.0.1 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from matplotlib>=3.0.0->geatpy) (1.1.0) Requirement already satisfied: cycler>=0.10 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from matplotlib>=3.0.0->geatpy) (0.10.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from matplotlib>=3.0.0->geatpy) (2.4.7) Requirement already satisfied: six>=1.5 in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from python-dateutil>=2.1->matplotlib>=3.0.0->geatpy) (1.14.0) Requirement already satisfied: setuptools in /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib>=3.0.0->geatpy) (46.4.0.post20200518) Installing collected packages: geatpy Successfully installed geatpy-2.5.1 (py3.7) IT-C02YPCXVLVCF:build jonny$ python Python 3.7.5 (default, Oct 25 2019, 10:52:18) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information.

import geatpy Traceback (most recent call last): File "", line 1, in File "/opt/anaconda3/envs/py3.7/lib/python3.7/site-packages/geatpy/init.py", line 17, in from boundfix import boundfix ImportError: dlopen(/opt/anaconda3/envs/py3.7/lib/python3.7/site-packages/geatpy/core/boundfix.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libgomp.1.dylib Referenced from: /opt/anaconda3/envs/py3.7/lib/python3.7/site-packages/geatpy/core/boundfix.cpython-37m-darwin.so Reason: image not found

`

geatpy-dev commented 4 years ago

@sizer74 @rubby33 为了不给用户的安装和使用带来不便,下一个发行版将会彻底移除对openmp的依赖,届时直接安装就可以import了。给用户们带来不便我们在此深表歉意!

另外:当前版本(2.5.1),使用mac的用户可以用python3.5直接安装和使用,无需安装额外的依赖包。

FaustDu commented 4 years ago

python 3.7.7 geatpy 2.5.1 不能import,请问怎么办呢

geatpy-dev commented 4 years ago

@FaustDu hi,先用python3.5用着吧,部分苹果电脑的python3.6,3.7和3.8都出现了无法兼容的情况。

joyc commented 4 years ago

同样问题报备 macOS 10.15.6, py3.7.3。

geatpy-dev commented 4 years ago

已更新2.6.0,该问题已得到解决。