Closed johanneskind closed 3 years ago
I suspect there may be a different python module with the same name 'platypus'. If you do not use this other module, I would suggest uninstalling it and installing Platypus using one of the methods documented in the Readme file. For example, if you use pip, run:
pip uninstall platypus
This is not the the case, but nontheless thanks for the advice! I followed the installations methods from the Readme file and therefore have only got Platypus-Opt installed (pip list
only gives me Platypus-Opt
). Still the syntax is not working for me.
What output do you get when you run:
import platypus
dir(platypus)
Thanks
The output of
import platypus
dir(platypus)
is the following
['ABCMeta', 'AbstractGeneticAlgorithm', 'AdaptiveGridArchive', 'AdaptiveTimeContinuation', 'Algorithm', 'ApplyEvaluator', 'Archive', 'AttributeDominance', 'Binary', 'BitFlip', 'CF1', 'CF10', 'CF2', 'CF3', 'CF4', 'CF5', 'CF6', 'CF7', 'CF8', 'CF9', 'CMAES', 'CompoundMutation', 'CompoundOperator', 'Constraint', 'DTLZ1', 'DTLZ2', 'DTLZ3', 'DTLZ4', 'DTLZ7', 'DifferentialEvolution', 'DistanceMatrix', 'Dominance', 'EPSILON', 'EpsMOEA', 'EpsNSGAII', 'EpsilonBoxArchive', 'EpsilonDominance', 'EpsilonIndicator', 'EpsilonProgressContinuation', 'Evaluator', 'EvolutionaryStrategy', 'ExperimentJob', 'FitnessArchive', 'FitnessEvaluator', 'FixedLengthArray', 'GAOperator', 'GDE3', 'GenerationalDistance', 'Generator', 'GeneticAlgorithm', 'HUX', 'Hypervolume', 'HypervolumeFitnessEvaluator', 'IBEA', 'Indicator', 'IndicatorJob', 'InjectedPopulation', 'Insertion', 'Integer', 'InvertedGenerationalDistance', 'Job', 'LOGGER', 'MOEAD', 'MapEvaluator', 'MaxEvaluations', 'MaxTime', 'Multimethod', 'MultiprocessingEvaluator', 'Mutation', 'NSGAII', 'NSGAIII', 'NonUniformMutation', 'OMOPSO', 'OrderedDict', 'PAES', 'PCX', 'PESA2', 'PM', 'PMX', 'POSITIVE_INFINITY', 'ParetoDominance', 'ParticleSwarm', 'PeriodicAction', 'Permutation', 'PlatypusError', 'PoolEvaluator', 'Problem', 'ProcessPoolEvaluator', 'RandomGenerator', 'Real', 'RegionBasedSelector', 'Replace', 'SBX', 'SMPSO', 'SPEA2', 'SPX', 'SSX', 'Selector', 'SingleObjectiveAlgorithm', 'SingularError', 'Solution', 'Spacing', 'SubmitEvaluator', 'Subset', 'Swap', 'TerminationCondition', 'TournamentSelector', 'Type', 'UF1', 'UF10', 'UF11', 'UF12', 'UF13', 'UF2', 'UF3', 'UF4', 'UF5', 'UF6', 'UF7', 'UF8', 'UF9', 'UM', 'UNDX', 'UniformMutation', 'Variator', 'WFG', 'WFG1', 'WFG2', 'WFG3', 'WFG4', 'WFG5', 'WFG6', 'WFG7', 'WFG8', 'WFG9', 'ZDT', 'ZDT1', 'ZDT2', 'ZDT3', 'ZDT4', 'ZDT5', 'ZDT6', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'absolute_import', 'abstractmethod', 'add', 'algorithms', 'bin2gray', 'bin2int', 'calculate', 'calculate_job_generator', 'chebyshev', 'check_eigensystem', 'choose', 'clip', 'config', 'copy', 'core', 'crowding_distance', 'crowding_distance_key', 'datetime', 'default_mutator', 'default_variator', 'display', 'distance_to_nearest', 'division', 'dot', 'euclidean_dist', 'evaluate_job_generator', 'evaluator', 'experiment', 'experimenter', 'fitness_key', 'functools', 'gray2bin', 'hypot', 'indicators', 'inspect', 'int2bin', 'is_zero', 'itertools', 'logging', 'lsolve', 'magnitude', 'manhattan_dist', 'math', 'multiply', 'nondominated', 'nondominated_cmp', 'nondominated_prune', 'nondominated_sort', 'nondominated_split', 'nondominated_truncate', 'normal_boundary_weights', 'normalize', 'normalized_euclidean_dist', 'objective_key', 'only_keys', 'only_keys_for', 'operator', 'operators', 'orthogonalize', 'pbi', 'point_line_dist', 'print_function', 'problems', 'project', 'random', 'random_vector', 'random_weights', 'reduce', 'remove_keys', 'roulette', 'run_job', 'six', 'subtract', 'sys', 'time', 'tools', 'tql2', 'tred2', 'truncate_fitness', 'types', 'unique', 'weights', 'zeros']
The recent upgrade from platypus 1.0.2 to 1.0.3 seems to have fixed the problem. Thanks!
I am struggling with the same issue on apparently version 1.0.3, please reopen
Alright, reopened. Good luck with this issue!
Hi,
Thanks for such great package!
Unfortunately, I am experiencing the same issue with Python 3.6.5 64 bits on a windows machine. To install Platypus, I used "pip install platypus" which installed this version: Platypus (1.0)
if run these commands:
import platypus dir(platypus) ['builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec']
from platypus import Problem Traceback (most recent call last): File "
", line 1, in ImportError: cannot import name 'Problem'
According to pip list command, I don't have other packages with a similar name that could cause a conflict.
Any suggestions?
Many thanks,
Ivan
Please disregard my previous comment, the right way to install the package is : pip install platypus-opt
thanks for all!
Hi, I am struggling with the same issue on version 1.0.4, please reopen. The following
import platypus
dir(platypus)
returns only
['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
Hi, I am struggling with the same issue on version 1.0.4, please reopen. The following
import platypus
dir(platypus)
returns only['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
It turns out using python 3.7+ resolves the issue. Please ignore.
The given example in README.md for a biobjective problem doesn't work when platypus was installed using pip.
from platypus import NSGAII, Problem, Real
This leads to the errorImportError: cannot import name 'NSGAII'
The correct form is: