I don't know whether I've come to to correct place, but I'm now trying to run a program on 64-bit Windows, Python 3.5.1 that requires PyGMO.
I downloaded the msi release of 1.1.7 (Downloaded here), run the installer, and try to run the program, and this error follows:
Traceback (most recent call last):
File "Desktop\test-1.py", line 4, in <module>
from PyGMO import *
File "C:\Users\ycl\Anaconda3\lib\site-packages\PyGMO\__init__.py", line 57, in <module>
from PyGMO import core, algorithm, migration, problem, topology, test, util
File "C:\Users\ycl\Anaconda3\lib\site-packages\PyGMO\core\__init__.py", line 2, in <module>
from PyGMO.core._core import *
ImportError: DLL load failed: The specified module could not be found.
The progam is a single script like this:
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from PyGMO import *
edge_weights = np.loadtxt("ir33_weight_matrix.txt", delimiter=',')
print(edge_weights[0])
areas = np.loadtxt("ir33_areas.txt", delimiter=',')
print(areas)
N = len(areas)
node_weights = [int(round(10000*areas[i])) for i in range(N)]
capacity = 1000
prob = problem.tsp(edge_weights, node_weights, capacity, type = 'cities')
pop = population(prob, 100)
steps = 3000
stepsize = 100
algo = algorithm.inverover(gen=stepsize,ri=0.05,type="random")
c = []
g = []
prev_f = 0
for i in range(steps):
pop = algo.evolve(pop)
f = pop.champion.f[0]
if prev_f != f:
c.append(pop.champion.x)
g.append((i+1)*stepsize)
prev_f = f
f, _, id1, id2 = prob.find_city_subsequence(pop.champion.x)
f = f*0.0001
if id1 <= id2:
visited_cities = c[-1][id1:(id2 + 1) % N]
else:
visited_cities = c[-1][id1:] + c[-1][:id2 + 1]
print("The fitness of the of the best found tour is: %f " % f)
print("The according removal sequence is: ")
print(visited_cities)
fig = plt.figure()
ax = plt.axes(xlim=(-10,N+10), ylim=(-0.05,1))
plt.ylabel('cross section area')
plt.xlabel('debris piece index')
line1, = ax.plot([],[], marker='o',markersize=10, alpha=0.7, linestyle='', color='r')
line2, = ax.plot([],[], marker='o',markersize=6, alpha=0.4, linestyle='', color='b')
generations_text = ax.text(0.05, 0.95, '', transform=ax.transAxes)
fitness_text = ax.text(0.40, 0.95, '', transform=ax.transAxes)
length_text = ax.text(0.75, 0.95, '', transform=ax.transAxes)
def init():
line1.set_data([], [])
line2.set_data([], [])
generations_text.set_text('')
fitness_text.set_text('')
length_text.set_text('')
return line1, line2, generations_text, fitness_text, length_text
def animate(ll):
f, _, id1, id2 = prob.find_city_subsequence(c[ll])
f = 0.0001*f
if id1 <= (id2 +1) % N:
visited_cities = c[ll][id1:(id2 + 1)]
else:
visited_cities = c[ll][id1:] + c[ll][:(id2 + 1) % N]
area_visited = [areas[i] for i in visited_cities]
not_visited_cities = [i for i in range(N) if i not in visited_cities]
area_not_visited = [areas[i] for i in not_visited_cities]
line1.set_data(visited_cities, area_visited)
line2.set_data(not_visited_cities, area_not_visited)
generations_text.set_text('generations = %d' % g[ll])
fitness_text.set_text('fitness = %.4f' % f)
length_text.set_text('tour length = %d' % len(visited_cities))
return line1, line2, generations_text, fitness_text, length_text
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=len(g), interval=150, blit=True, repeat=False)
plt.show()
Does anyone has any experience with this?
I have no idea where to locate the DLLs at all...
You problem is probably created by the python version not matching the one expected by the msi.
Anyway, the new pagmo (https://github.com/esa/pagmo2) provides binaries for most python versions and osx both via
pip
andconda
(this last being the suggested choice as it avoids libraries incompatibilities between multiple packages that use boost::python)conda install pygmo
or,pip install pygmo
should now solve your problems. Note that the new pagmo syntax has changed , refer to the docs for the updates.