Giter Club home page Giter Club logo

tsne's Introduction

NOT MAINTAINED

  • I have not used this project myself on a long time
  • No issues or PRs can be created
  • At the time of writting this April 6, 2023 - The lastest release on PyPI (0.3.1) works as intented
  • I recommend moving to a native solution to other frameworks such as Tensorflow or PyTorch

Python-TSNE

pypi build coverage license

Python library containing T-SNE algorithms.

Note: Scikit-learn v0.17 includes TSNE algorithms and you should probably be using that instead.

Installation

Requirements

  • cblas or openblas. Tested version is v0.2.5 and v0.2.6 (not necessary for OSX).

From PyPI:

pip install tsne

From conda:

conda install -c maxibor tsne

Usage

Basic usage:

from tsne import bh_sne
X_2d = bh_sne(X)

Examples

Algorithms

Barnes-Hut-SNE

A python (cython) wrapper for Barnes-Hut-SNE aka fast-tsne.

I basically took osdf's code and made it pip compliant.

Additional resources

  • See Barnes-Hut-SNE (2013), L.J.P. van der Maaten. It is available on arxiv.

tsne's People

Contributors

airalcorn2 avatar bayerj avatar danielfrg avatar elliottd avatar maxibor avatar mschubert avatar osdf avatar pryvkin10x avatar wiscevan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tsne's Issues

license clarification

The setup.py file mentions Apache 2 while the License file mentions 4-clause (original) BSD license. Can you clarify the license please. Also note that the 4-clause BSD license is not GPL compatible and is actually a pretty rare license this days.

In addition, would be nice if the individual files had the license notice since it's not clear what is covered by the license and who's the copyright holder for each file. The python code have no copyright notice at all. The license file also only appeared with commit b9c6bd8 and I can't find to what parts of the code it applies.

Is it possible to set the seed or random state on bh_sne?

Hi Daniel,

I was wondering if it was possible to set the seed or random state on bh_sne. From my inspection of bh_sne(data, pca_d=None, d=2, perplexity=30.0, theta=0.5) it seems there aren't any explicit arguments for the seed.

I think setting the seed is crucial when bh_sne is being used in part of a larger system, so we can remove the randomness from bh_sne to test other components of the system in isolation. If you can point me in the right direction, that would be awesome (I can send a pull request if you think the seed/random_state should be added to bh_sne).

Best,
Shuvro

Windows installation error

C:\Python27>pip install git+https://github.com/danielfrg/tsne.git
Collecting git+https://github.com/danielfrg/tsne.git
  Cloning https://github.com/danielfrg/tsne.git to c:\users\akshayc\appdata\local\temp\pip-0wq9im-build
Requirement already satisfied: Cython>=0.19.1 in c:\python27\lib\site-packages (from tsne==0.1.7)
Requirement already satisfied: numpy>=1.7.1 in c:\python27\lib\site-packages (from tsne==0.1.7)
Requirement already satisfied: scipy>=0.12.0 in c:\python27\lib\site-packages (from tsne==0.1.7)
Installing collected packages: tsne
  Running setup.py install for tsne ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\akshayc\\appdata\\local\\temp\\pip-0wq9im-build\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\akshayc\appdata\local\temp\pip-_nui6m-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    creating build\lib.win32-2.7\tsne
    copying tsne\_version.py -> build\lib.win32-2.7\tsne
    copying tsne\__init__.py -> build\lib.win32-2.7\tsne
    creating build\lib.win32-2.7\tsne\tests
    copying tsne\tests\test_iris.py -> build\lib.win32-2.7\tsne\tests
    copying tsne\tests\test_seed.py -> build\lib.win32-2.7\tsne\tests
    copying tsne\tests\__init__.py -> build\lib.win32-2.7\tsne\tests
    UPDATING build\lib.win32-2.7\tsne/_version.py
    set build\lib.win32-2.7\tsne/_version.py to '0.1.7'
    running build_ext
    building 'bh_sne' extension
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\tsne
    creating build\temp.win32-2.7\Release\tsne\bh_sne_src
    C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\lib\site-packages\numpy\core\include -I/usr/local/include -Itsne/bh_sne_src/ -Ic:\python27\include -Ic:\python27\PC /Tptsne/bh_sne.cpp /Fobuild\temp.win32-2.7\Release\tsne/bh_sne.obj -msse2 -O3 -fPIC -w
    cl : Command line warning D9025 : overriding '/W3' with '/w'
    cl : Command line warning D9002 : ignoring unknown option '-msse2'
    cl : Command line warning D9002 : ignoring unknown option '-O3'
    cl : Command line warning D9002 : ignoring unknown option '-fPIC'
    bh_sne.cpp
    c:\python27\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\lib\site-packages\numpy\core\include -I/usr/local/include -Itsne/bh_sne_src/ -Ic:\python27\include -Ic:\python27\PC /Tptsne/bh_sne_src/quadtree.cpp /Fobuild\temp.win32-2.7\Release\tsne/bh_sne_src/quadtree.obj -msse2 -O3 -fPIC -w
    cl : Command line warning D9025 : overriding '/W3' with '/w'
    cl : Command line warning D9002 : ignoring unknown option '-msse2'
    cl : Command line warning D9002 : ignoring unknown option '-O3'
    cl : Command line warning D9002 : ignoring unknown option '-fPIC'
    quadtree.cpp
    **c:\users\akshayc\appdata\local\temp\pip-0wq9im-build\tsne\bh_sne_src\quadtree.h(13) : error C2871: 'std' : a namespace with this name does not exist
    c:\users\akshayc\appdata\local\temp\pip-0wq9im-build\tsne\bh_sne_src\quadtree.h(17) : error C2375: 'abs' : redefinition; different linkage
            C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\math.h(487) : see declaration of 'abs'**
    error: command 'C:\\Users\\AkshayC\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\akshayc\\appdata\\local\\temp\\pip-0wq9im-build\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\akshayc\appdata\local\temp\pip-_nui6m-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\akshayc\appdata\local\temp\pip-0wq9im-build\

Windows Installation

Is there any windows support for this lib at all?

It always show an error: The system cannot find the path specified: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\PlatformSDK\lib

pip install error

Building wheels for collected packages: tsne
Building wheel for tsne (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for tsne (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [82 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/tsne
copying tsne/init.py -> build/lib.linux-x86_64-cpython-38/tsne
copying tsne/_bh_sne.py -> build/lib.linux-x86_64-cpython-38/tsne
copying tsne/_generated_version.py -> build/lib.linux-x86_64-cpython-38/tsne
creating build/lib.linux-x86_64-cpython-38/tsne/tests
copying tsne/tests/init.py -> build/lib.linux-x86_64-cpython-38/tsne/tests
copying tsne/tests/test_import.py -> build/lib.linux-x86_64-cpython-38/tsne/tests
copying tsne/tests/test_iris.py -> build/lib.linux-x86_64-cpython-38/tsne/tests
copying tsne/tests/test_seed.py -> build/lib.linux-x86_64-cpython-38/tsne/tests
running egg_info
writing tsne.egg-info/PKG-INFO
writing dependency_links to tsne.egg-info/dependency_links.txt
writing requirements to tsne.egg-info/requires.txt
writing top-level names to tsne.egg-info/top_level.txt
listing git files failed - pretending there aren't any
reading manifest file 'tsne.egg-info/SOURCES.txt'
adding license file 'LICENSE.txt'
writing manifest file 'tsne.egg-info/SOURCES.txt'
copying tsne/bh_sne.pyx -> build/lib.linux-x86_64-cpython-38/tsne
creating build/lib.linux-x86_64-cpython-38/tsne/includes
creating build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/LICENSE -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/Readme.txt -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/compile_linux -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/compile_mac -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/fast_tsne.m -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/quadtree.cpp -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/quadtree.h -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/tsne.cpp -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/tsne.h -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
copying tsne/includes/bh_tsne/vptree.h -> build/lib.linux-x86_64-cpython-38/tsne/includes/bh_tsne
running build_ext
Running custom build_ext
cythoning tsne/bh_sne.pyx to tsne/bh_sne.cpp
building 'bh_sne' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/tsne
creating build/temp.linux-x86_64-cpython-38/tsne/includes
creating build/temp.linux-x86_64-cpython-38/tsne/includes/bh_tsne
gcc -pthread -B /mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -Itsne/includes/bh_tsne/ -I/tmp/pip-build-env-ck34i7ju/overlay/lib/python3.8/site-packages/numpy/core/include -I/mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/include/python3.8 -c tsne/bh_sne.cpp -o build/temp.linux-x86_64-cpython-38/tsne/bh_sne.o -msse2 -O3 -fPIC -w
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -Itsne/includes/bh_tsne/ -I/tmp/pip-build-env-ck34i7ju/overlay/lib/python3.8/site-packages/numpy/core/include -I/mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/include/python3.8 -c tsne/includes/bh_tsne/quadtree.cpp -o build/temp.linux-x86_64-cpython-38/tsne/includes/bh_tsne/quadtree.o -msse2 -O3 -fPIC -w
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -Itsne/includes/bh_tsne/ -I/tmp/pip-build-env-ck34i7ju/overlay/lib/python3.8/site-packages/numpy/core/include -I/mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/include/python3.8 -c tsne/includes/bh_tsne/tsne.cpp -o build/temp.linux-x86_64-cpython-38/tsne/includes/bh_tsne/tsne.o -msse2 -O3 -fPIC -w
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
g++ -pthread -B /mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/compiler_compat -Wl,--sysroot=/ -pthread -shared -B /mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/compiler_compat -L/mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/lib -Wl,-rpath=/mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-38/tsne/bh_sne.o build/temp.linux-x86_64-cpython-38/tsne/includes/bh_tsne/quadtree.o build/temp.linux-x86_64-cpython-38/tsne/includes/bh_tsne/tsne.o -L/usr/local/lib -o build/lib.linux-x86_64-cpython-38/bh_sne.cpython-38-x86_64-linux-gnu.so -lcblas
/mnt/cache/zhouyuhang/opt/miniconda3/envs/fscil/compiler_compat/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
/tmp/pip-build-env-ck34i7ju/overlay/lib/python3.8/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing 'tsne.includes.bh_tsne' as data is deprecated, please list it in packages.
!!

      ############################
      # Package would be ignored #
      ############################
      Python recognizes 'tsne.includes.bh_tsne' as an importable package,
      but it is not listed in the `packages` configuration of setuptools.
  
      'tsne.includes.bh_tsne' has been automatically added to the distribution only
      because it may contain data files, but this behavior is likely to change
      in future versions of setuptools (and therefore is considered deprecated).
  
      Please make sure that 'tsne.includes.bh_tsne' is included as a package by using
      the `packages` configuration field or the proper discovery methods
      (for example by using `find_namespace_packages(...)`/`find_namespace:`
      instead of `find_packages(...)`/`find:`).
  
      You can read more about "package discovery" and "data files" on setuptools
      documentation page.
  
  
  !!
  
    check.warn(importable)
  /tmp/pip-build-env-ck34i7ju/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-dj7ebrgz/tsne_82536279325b40faad04bf8a3c5a67f7/tsne/bh_sne.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command '/usr/bin/g++' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tsne
Failed to build tsne
ERROR: Could not build wheels for tsne, which is required to install pyproject.toml-based projects

Error installing on OSX El Capitan

I am having issues installing tsne on El Capitan. I've tried using both the pypi source and the git version but get the same error:

pip install tsne
Collecting tsne
  Using cached tsne-0.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/var/folders/1j/l25m3sbs51gbfpynfwny1xvc0000gn/T/pip-build-LDFM7r/tsne/setup.py", line 15, in <module>
        v1, v2, v3 = [float(val) for val in v.split('.')]
    ValueError: need more than 2 values to unpack

any ideas how to fix this?

Running into relative import issues while trying to import bh_sne

Please help me with this issue. I am currently running Python 3.4 on Ubuntu 14.04 with 60 GB RAM. I installed tsne from source with command:
sudo -H pip3 install git+https://github.com/danielfrg/tsne.git

  1. While that was successful, when testing the import, I got a relative import error:
>>> import tsne
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/tsne/__init__.py", line 6, in <module>
    from bh_sne import BH_SNE
  File "tsne/bh_sne.pyx", line 2, in init tsne.bh_sne (tsne/bh_sne.cpp:4867)
SystemError: Parent module '' not loaded, cannot perform relative import

>>> from tsne import bh_sne
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/tsne/__init__.py", line 6, in <module>
    from bh_sne import BH_SNE
  File "tsne/bh_sne.pyx", line 2, in init tsne.bh_sne (tsne/bh_sne.cpp:4867)
SystemError: Parent module '' not loaded, cannot perform relative import
>>> 
  1. Also, I noticed something strange however. I tried to import BH_SNE from tsne.bh_sne. If I do it right off the bat in python, it fails, with the same error:
>>> from tsne.bh_sne import BH_SNE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/tsne/__init__.py", line 6, in <module>
    from bh_sne import BH_SNE
  File "tsne/bh_sne.pyx", line 2, in init tsne.bh_sne (tsne/bh_sne.cpp:4867)
SystemError: Parent module '' not loaded, cannot perform relative import
  1. However, if I first try importing tsne or bh_sne, or even repeat the above command, it succeeds:
root@ip-172-31-27-17:/# python3
Python 3.4.3 (default, Sep 14 2016, 12:36:27) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tsne import bh_sne
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/tsne/__init__.py", line 6, in <module>
    from bh_sne import BH_SNE
  File "tsne/bh_sne.pyx", line 2, in init tsne.bh_sne (tsne/bh_sne.cpp:4867)
SystemError: Parent module '' not loaded, cannot perform relative import
>>> from tsne.bh_sne import BH_SNE
>>> BH_SNE()
<tsne.bh_sne.BH_SNE object at 0x7ffa28a9c498>
>>> 

Error on pip3 installing on Mac OS High Sierra (10.13)

With

  • python 3.6.2
  • pip3 v9.0.1
  • Apple LLVM version 9.0.0 (clang-900.0.37)
  • numpy v1.13.3

pip3 install tsne yields

  In file included from tsne/bh_sne_src/quadtree.cpp:15:
  tsne/bh_sne_src/quadtree.h:17:22: error: static declaration of 'abs' follows non-static declaration
  static inline double abs(double x) { return (x < .0 ? -x : x); }
                       ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:697:1: note: previous definition is here
  abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
  ^
  1 error generated.
  error: command 'clang' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for tsne
  Running setup.py clean for tsne
Failed to build tsne

Any solutions? Is the problem on my end?

__
For completeness, a deprication warning for numpy version is also produced.

  /usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
  1 warning generated.

Problem with d=3

I get buggy results when running with d=3. Here is some example code comparing d=2 to d=3.

%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from tsne import bh_sne
X = np.random.random((1000,100))

X_2d = bh_sne(X, d=2)
plt.scatter(X_2d[:,0], X_2d[:,1], s=2, edgecolor='')
plt.show()

X_3d = bh_sne(X, d=3)
plt.scatter(X_3d[:,0], X_3d[:,1], s=2, edgecolor='')
plt.show()
plt.scatter(X_3d[:,0], X_3d[:,2], s=2, edgecolor='')
plt.show()

good-d2
good
bad

Doesn't build on ARM

-msse2 flag doesn't work on ARM architecture:

  cc1plus: error: unrecognized command line option ‘-msse2’

OpenBLAS compatability

The repository purports to be compatible with OpenBLAS, but when linking the compiled files, it currently always use -lcblas. If I manually change setup.py to use extra_link_args=['-lopenblas'] instead, then it will correctly link and build. However, I shouldn't have to do that, and the process of detecting cblas vs OpenBLAS should occur automatically.

Error installing tsne for Python3 from source

Please ref log below:

shans-mbp:Downloads shansabri$ tar -zxvf tsne-0.1.5.tar.gz 
x tsne-0.1.5/
x tsne-0.1.5/LICENSE.txt
x tsne-0.1.5/MANIFEST.in
x tsne-0.1.5/PKG-INFO
x tsne-0.1.5/requirements.txt
x tsne-0.1.5/setup.cfg
x tsne-0.1.5/setup.py
x tsne-0.1.5/tsne/
x tsne-0.1.5/tsne/__init__.py
x tsne-0.1.5/tsne/_version.py
x tsne-0.1.5/tsne/bh_sne.pyx
x tsne-0.1.5/tsne/bh_sne_src/
x tsne-0.1.5/tsne/bh_sne_src/compile_linux
x tsne-0.1.5/tsne/bh_sne_src/compile_mac
x tsne-0.1.5/tsne/bh_sne_src/fast_tsne.m
x tsne-0.1.5/tsne/bh_sne_src/quadtree.cpp
x tsne-0.1.5/tsne/bh_sne_src/quadtree.h
x tsne-0.1.5/tsne/bh_sne_src/Readme.txt
x tsne-0.1.5/tsne/bh_sne_src/tsne.cpp
x tsne-0.1.5/tsne/bh_sne_src/tsne.h
x tsne-0.1.5/tsne/bh_sne_src/vptree.h
x tsne-0.1.5/tsne/tests/
x tsne-0.1.5/tsne/tests/__init__.py
x tsne-0.1.5/tsne/tests/test_iris.py
x tsne-0.1.5/tsne.egg-info/
x tsne-0.1.5/tsne.egg-info/dependency_links.txt
x tsne-0.1.5/tsne.egg-info/PKG-INFO
x tsne-0.1.5/tsne.egg-info/requires.txt
x tsne-0.1.5/tsne.egg-info/SOURCES.txt
x tsne-0.1.5/tsne.egg-info/top_level.txt
x tsne-0.1.5/versioneer.py
shans-mbp:Downloads shansabri$ cd tsne-0.1.5
shans-mbp:tsne-0.1.5 shansabri$ python3 setup.py install
  File "setup.py", line 61
    print '!!!!!!!!!!!!!', find_packages()
                        ^
SyntaxError: invalid syntax

It gives syntax error.

Collecting tsne
Using cached tsne-0.1.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\mohammad\AppData\Local\Temp\pip-build-3vw4ikmt\tsne\setup.py", line 61
print '!!!!!!!!!!!!!', find_packages()
^
SyntaxError: invalid syntax

----------------------------------------

OS X Yosemite Support?

I've installed successfully on OSX 10.9.3., but I'm having trouble installing on OS X yosemite (10.10.2). I have all the requirements mentioned besides cblas or openblas.

When i run

pip install tsne

Here's a snippet of the reported error.

    tsne/bh_sne_src/quadtree.cpp:12:10: fatal error: 'cblas.h' file not found

    #include <cblas.h>

Am I making a mistake or is there no Yosemite support?

AttributeError: type object 'tsne.bh_sne.BH_SNE' has no attribute '__reduce_cython__'

After installed via pip install git+https://github.com/danielfrg/tsne.git

On from tsne import bh_sne

I get:

    from bh_sne import BH_SNE
  File "tsne/bh_sne.pyx", line 12, in init tsne.bh_sne
AttributeError: type object 'tsne.bh_sne.BH_SNE' has no attribute '__reduce_cython__'
pip show Cython
Name: Cython
Version: 0.27.3
Summary: The Cython compiler for writing C extensions for the Python language.
Home-page: http://cython.org/
Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.
Author-email: [email protected]
License: Apache
Location: /home/user/miniconda3/lib/python3.6/site-packages
Requires: 
which python
/home/user/miniconda3/bin/python
which pip
/home/user/miniconda3/bin/pip
python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

Error installing on Ubunty - error: unknown file type '.pyx'

Both: pip install tsne and pip install git+https://github.com/danielfrg/tsne.git give the following error:

Collecting git+https://github.com/danielfrg/tsne.git
  Cloning https://github.com/danielfrg/tsne.git to /tmp/pip-ROoQcx-build
Requirement already satisfied (use --upgrade to upgrade): Cython>=0.19.1 in ./anaconda/lib/python2.7/site-packages (f
rom tsne==0.1.3+3.g1eebbd4)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.1 in ./anaconda/lib/python2.7/site-packages (fro
m tsne==0.1.3+3.g1eebbd4)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.12.0 in ./anaconda/lib/python2.7/site-packages (fr
om tsne==0.1.3+3.g1eebbd4)
Installing collected packages: tsne
  Running setup.py install for tsne
    Complete output from command /home/guido/dev/libs/anaconda/bin/python -c "import setuptools, tokenize;__file__='/
tmp/pip-ROoQcx-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), _
_file__, 'exec'))" install --record /tmp/pip-dh8KJV-record/install-record.txt --single-version-externally-managed --c
ompile:
    /home/guido/dev/libs/anaconda/lib/python2.7/site-packages/setuptools-17.1.1-py2.7.egg/setuptools/dist.py:285: Use
rWarning: Normalizing 'v0.1.3+3.g1eebbd4' to '0.1.3+3.g1eebbd4'
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/tsne
    copying tsne/_version.py -> build/lib.linux-x86_64-2.7/tsne
    copying tsne/__init__.py -> build/lib.linux-x86_64-2.7/tsne
    UPDATING build/lib.linux-x86_64-2.7/tsne/_version.py
    set build/lib.linux-x86_64-2.7/tsne/_version.py to 'v0.1.3+3.g1eebbd4'
    running build_ext
    building 'bh_sne' extension
    error: unknown file type '.pyx' (from 'tsne/bh_sne.pyx')

    ----------------------------------------
Command "/home/guido/dev/libs/anaconda/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-ROoQcx-build/set
up.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" insta
ll --record /tmp/pip-dh8KJV-record/install-record.txt --single-version-externally-managed --compile" failed with erro
r code 1 in /tmp/pip-ROoQcx-build

Other Details:
OS: Ubuntu 14.04.3 LTS - 64 bit
Python: Anaconda - Python 2.7

Anything else you need?

Cheers

Edit 1:
Tried installing from git python setup.py install gives same error
Tried manually installing all dependencies (saw another bug about versioneer), this did not help

Make Cython a proper setup_requirement

Currently, if a user doesn't have Cython installed, trying to install this package results in an error:

Collecting tsne
  Using cached tsne-0.1.7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9w8mswlw/tsne/setup.py", line 18, in <module>
        from Cython.Distutils import build_ext
    ImportError: No module named 'Cython'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9w8mswlw/tsne/

Please specify Cython in setup_requires, and leave handling compilation of .pyx files to setuptools; as of version 18.0 setuptools supports this natively:

setup(name='tsne',
      version=versioneer.get_version(),
      cmdclass=versioneer.get_cmdclass(),
      author='Daniel Rodriguez',
      author_email='[email protected]',
      url='https://github.com/danielfrg/py_tsne',
      description='TSNE implementations for python',
      license='Apache License Version 2.0, January 2004',
      packages=find_packages(),
      ext_modules=ext_modules,
      setup_requires=['cython'],
      install_requires=required
)

(dropping the Cython imports and the two lines that use those imports)

Client.Timeout under proxy installing tsne with docker

~/repos/tsne$ sudo docker build -t tsne .
Sending build context to Docker daemon  3.786MB
Step 1/5 : FROM continuumio/miniconda
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

natalia@nataliaHPProDesk:~/repos/tsne$ sudo -E docker build -t tsne .
Sending build context to Docker daemon  3.786MB
Step 1/5 : FROM continuumio/miniconda
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

Installation issues with Ubuntu 17.04 / gcc 4.9.4

I'm having an issue installing. Another person posted something similar a few months ago with no resolution here:
https://askubuntu.com/questions/920149/t-sne-installation-error?newreg=1ad2745e23754d6ba070cd3b8fcaa34b

UPDATE
I have now tried gcc 4.9.4, gcc 4.8.5, gcc 4.7.4. None work.

Failed building wheel for tsne
  Running setup.py clean for tsne
Failed to build tsne
Installing collected packages: Cython, numpy, scipy, tsne
  Running setup.py install for tsne ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0rmDBp/tsne/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-U7ut7H-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Warning: Extension name 'bh_sne' does not match fully qualified name 'tsne.bh_sne' of 'tsne/bh_sne.pyx'
    Compiling tsne/bh_sne.pyx because it depends on /home/rob/.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd.
    [1/1] Cythonizing tsne/bh_sne.pyx
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/tsne
    copying tsne/_version.py -> build/lib.linux-x86_64-2.7/tsne
    copying tsne/__init__.py -> build/lib.linux-x86_64-2.7/tsne
    creating build/lib.linux-x86_64-2.7/tsne/tests
    copying tsne/tests/test_seed.py -> build/lib.linux-x86_64-2.7/tsne/tests
    copying tsne/tests/test_iris.py -> build/lib.linux-x86_64-2.7/tsne/tests
    copying tsne/tests/__init__.py -> build/lib.linux-x86_64-2.7/tsne/tests
    UPDATING build/lib.linux-x86_64-2.7/tsne/_version.py
    set build/lib.linux-x86_64-2.7/tsne/_version.py to '0.1.7'
    running build_ext
    building 'bh_sne' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/tsne
    creating build/temp.linux-x86_64-2.7/tsne/bh_sne_src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/home/rob/.local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne.o -msse2 -O3 -fPIC -w
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/home/rob/.local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne_src/quadtree.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne_src/quadtree.o -msse2 -O3 -fPIC -w
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from tsne/bh_sne_src/quadtree.cpp:15:0:
    tsne/bh_sne_src/quadtree.h: In function ‘double abs(double)’:
    tsne/bh_sne_src/quadtree.h:17:34: error: ‘double abs(double)’ conflicts with a previous declaration
     static inline double abs(double x) { return (x < .0 ? -x : x); }
                                      ^
    In file included from /usr/include/c++/6/math.h:36:0,
                     from tsne/bh_sne_src/quadtree.cpp:10:
    /usr/include/c++/6/cmath:85:3: note: previous declaration ‘constexpr double std::abs(double)’
       abs(double __x)
       ^~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0rmDBp/tsne/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-U7ut7H-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-0rmDBp/tsne/

Any ideas what's causing this?

Difficulty with anaconda

Not sure exactly why, but building this from both source and with anaconda's pip resulted in the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "tsne/__init__.py", line 5, in <module>
    from bh_sne import BH_SNE
ImportError: ./bh_sne.so: undefined symbol: ATL_dgemm

The library always compiled correctly, but had this linking difficulty. Running ldd /path/to/bh_sne.so didn't report any dependency on libcblas.so, so something is going on wrong during linking. Possibly related to this.

Anyway, I eventually discovered that installing with /usr/bin/pip rather than anaconda dodged the issue, and copying bh_sne.so from the system path to the anaconda directory avoided the malformed shared object. So I've moved on - but I thought I would report anyway.

My system is Ubuntu 14.04 and I install cblas with sudo apt-get install libatlas-base-dev

Error while installing tsne library

$ pip install tsne
Downloading/unpacking tsne
  Downloading tsne-0.1.1.tar.gz (51kB): 51kB downloaded
  Running setup.py (path:/home/salil/.virtualenvs/ipynb/build/tsne/setup.py) egg_info for package tsne

Requirement already satisfied (use --upgrade to upgrade): Cython>=0.19.1 in ./.virtualenvs/ipynb/lib/python2.7/site-packages (from tsne)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.1 in /usr/lib/python2.7/dist-packages (from tsne)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.12.0 in /usr/lib/python2.7/dist-packages (from tsne)
Installing collected packages: tsne
  Running setup.py install for tsne
    skipping 'tsne/bh_sne.cpp' Cython extension (up-to-date)
    building 'bh_sne' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne_src/quadtree.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne_src/quadtree.o -msse2 -O3 -fPIC -w
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
    tsne/bh_sne_src/quadtree.cpp:12:19: fatal error: cblas.h: No such file or directory
     #include <cblas.h>
                       ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/salil/.virtualenvs/ipynb/bin/python -c "import setuptools, tokenize;__file__='/home/salil/.virtualenvs/ipynb/build/tsne/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qO42Vo-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/salil/.virtualenvs/ipynb/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/tsne

copying tsne/__init__.py -> build/lib.linux-x86_64-2.7/tsne

running build_ext

skipping 'tsne/bh_sne.cpp' Cython extension (up-to-date)

building 'bh_sne' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/tsne

creating build/temp.linux-x86_64-2.7/tsne/bh_sne_src

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne_src/quadtree.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne_src/quadtree.o -msse2 -O3 -fPIC -w

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]

tsne/bh_sne_src/quadtree.cpp:12:19: fatal error: cblas.h: No such file or directory

 #include <cblas.h>

                   ^

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/salil/.virtualenvs/ipynb/bin/python -c "import setuptools, tokenize;__file__='/home/salil/.virtualenvs/ipynb/build/tsne/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qO42Vo-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/salil/.virtualenvs/ipynb/include/site/python2.7 failed with error code 1 in /home/salil/.virtualenvs/ipynb/build/tsne
Traceback (most recent call last):
  File "/home/salil/.virtualenvs/ipynb/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

Solution for tsne doesn't work on Python3.5

I tried to use it in Python3.5. When I run this command "from tsne import bh_sne" to test I saw error:

from bh_sne import BH_SNE
File "tsne/bh_sne.pyx", line 2, in init tsne.bh_sne (tsne/bh_sne.cpp:4209)
SystemError: Parent module '' not loaded, cannot perform relative import

I digged a liitle into into it and found that it can be fixed by commenting out line 2 in file tsne/bh_sne.pyx, rebuild and install.
--------------------- tsne/bh_sne.pyx --------------------
import numpy as np <--- This is the line I commented out to make it work in Python3.5
cimport numpy as np
cimport cython

I don't know why this fixes the issue but just want leave some reference information for those will encounter the same problem as I did.

undefined symbol: ATL_dgemm

If I install from the source, and when I import tsne in ipython, I get the following error :

ImportError Traceback (most recent call last)
in ()
----> 1 import tsne
build/bdist.linux-x86_64/egg/tsne/init.py in ()
build/bdist.linux-x86_64/egg/bh_sne.py in ()
build/bdist.linux-x86_64/egg/bh_sne.py in bootstrap()

ImportError: /home/sivasurya/.python-eggs/tsne-0.1.5-py2.7-linux-x86_64.egg-tmp/bh_sne.so: undefined symbol: ATL_dgemm

If I install from pip, and when I import tsne in ipython, I get the following error :

ImportError Traceback (most recent call last)
in ()
----> 1 import tsne

/home/sivasurya/anaconda/lib/python2.7/site-packages/tsne/init.py in ()
3 import numpy as np
4 import scipy.linalg as la
----> 5 from bh_sne import BH_SNE

ImportError: /home/sivasurya/anaconda/lib/python2.7/site-packages/bh_sne.so: undefined symbol: ATL_dgemm

I have both openblas and atlas installed, where am I getting this error from.

Import error

Hi, when I try to call:

from tsne import bh_sne

I receive this error:

from tsne import bh_sne
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/tsne/__init__.py", line 6, in <module>
    from bh_sne import BH_SNE
  File "tsne/bh_sne.pyx", line 2, in init tsne.bh_sne
SystemError: Parent module '' not loaded, cannot perform relative import

I've used conda to reinstall sklearn which did not resolve this issue.
I'm using python 3.4 and sklearn 0.17

Thanks,
Lynn

Redundant abs() definition

In tsne/bh_sne_src/quadtree.h, the function double abs(double) conflicts with a previous declaration in either cmath or math.h. It should probably be removed. Otherwise, newer C++ compilers won't compile the source.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.