YingfanWang/PaCMAP

AttributeError: module 'pacmap' has no attribute 'PaCMAP'

Closed this issue · 9 comments

Hi

I was trying to run pacmap but i ran into the following error:

Python 3.7.0 (default, Oct 9 2018, 10:31:47)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import pacmap
import numpy as np
import matplotlib.pyplot as plt

loading preprocessed coil_20 dataset

... # you can change it with any dataset that is in the ndarray format, with the shape (N, D)
... # where N is the number of samples and D is the dimension of each sample
... X = np.load("./data/coil_20.npy", allow_pickle=True)

X = X.reshape(X.shape[0], -1)
y = np.load("./data/coil_20_labels.npy", allow_pickle=True)
embedding = pacmap.PaCMAP(n_dims=2, n_neighbors=None, MN_ratio=0.5, FP_ratio=2.0)
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'pacmap' has no attribute 'PaCMAP'

Please advise.

Thank you.

We haven't encountered such error before. Could you provide the following information:

  • How did you install pacmap? Though the version on PyPI should be consistent with this repo, installing from this repo hasn't be tested yet.
  • What is the version of pacmap you are using? You can check it by opening the IPython interface, import pacmap, and then enter pacmap.__version__

Hi Haiyang

i installed it using pip in my conda env and >>> pacmap.version
'0.4'

Hi Haiyang

i installed it using pip in my conda env and >>> pacmap.version
'0.4'

That's weird. Could you also try to do the following thing in your Python script:

  • import pacmap
  • Use 'pacmap.pacmap.PaCMAP' instead of pacmap.PaCMAP
    and see how it works?

very weird indeed. pacmap.pacmap.PaCMAP does not work either

embedding = pacmap.pacmap.PaCMAP(n_dims=2, n_neighbors=None, MN_ratio=0.5, FP_ratio=2.0)
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'pacmap' has no attribute 'pacmap'
embedding = pacmap.__
pacmap.cached pacmap.doc pacmap.getattribute( pacmap.le( pacmap.new( pacmap.repr( pacmap.subclasshook(
pacmap.class( pacmap.eq( pacmap.gt( pacmap.loader pacmap.package pacmap.setattr(
pacmap.delattr( pacmap.file pacmap.hash( pacmap.lt( pacmap.path pacmap.sizeof(
pacmap.dict pacmap.format( pacmap.init( pacmap.name pacmap.reduce( pacmap.spec
pacmap.dir( pacmap.ge( pacmap.init_subclass( pacmap.ne( pacmap.reduce_ex( pacmap.str(

i think it is a silly issue caused by where i run the command! if i am in the root PaCMAP dir i would need to import pacmap.pacmap

Thank you.

For others who are stuck on running the sample code.

You need to import submodule. So instead of

import pacmap

Do:

from pacmap import pacmap

And the the rest of the sample code should work.

For others who are stuck on running the sample code.

You need to import submodule. So instead of

import pacmap

Do:

from pacmap import pacmap

And the the rest of the sample code should work.

Thanks for reporting the problem! It seems like this problem is due to a bug in version 0.4.1. We will try to fix this as soon as possible!

The problem has been resolved now. Due to an incompatibility issue between numba and NumPy, the package now requires Numpy >= 1.20 and numba >= 0.50. For users that have earlier versions, we suggest you to use pacmap v0.4.