Closed ColdTeapot273K closed 4 years ago
@noklam any ideas?
@parrt I can install with the dependency I needed frome the source dircetory. @parrt I guess pip install tensor-sensor[torch] will only works after you push it to the pypi package?
Here are the steps that I can reproduce my environment without unnecessary dependencies.
conda create -n ts_new python==3.7.5
git clone https://github.com/parrt/tensor-sensor.git
cd tensor-sensor
pip install -e . # Editable install from source, it won't install either torch or tensorflow
I guess you have to run this command? Saw it from your README
python setup.py sdist upload
I don't have any experience publishing a package before
I'd like to jump in on this!
I just tried pip install tensor-sensor
and found that it was trying to install PyTorch:
$ pip install tensor-sensor
Collecting tensor-sensor
Downloading tensor-sensor-0.1b1.tar.gz (20 kB)
Collecting graphviz>=0.14.1
Downloading graphviz-0.14.2-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: numpy in /home/shawley/anaconda3/envs/spnet/lib/python3.7/site-packages (from tensor-sensor) (1.19.0)
Collecting torch
Downloading torch-1.6.0-cp37-cp37m-manylinux1_x86_64.whl (748.8 MB)
|▉ | 19.1 MB 3.4 MB/s eta 0:03:36^C
^C
ERROR: Operation cancelled by user
I've already got PyTorch installed in a different environment, so I only wanted just tensor-sensor. From my reading of the documentation I thought that was all I should be getting.
@drscotthawley can you try this?
git clone https://github.com/parrt/tensor-sensor.git cd tensor-sensor pip install -e .
@noklam That installed fine with no trying-to-install torch! Thanks.
Although I note that upon execution there's still a 'torch' dependency in the code :-( :
$ cat test.py
import numpy as np
n = 200 # number of instances
d = 764 # number of instance features
n_neurons = 100 # how many neurons in this layer?
W = np.random.rand(d,n_neurons) # Ooops! Should be (n_neurons,d) <=======
b = np.random.rand(n_neurons,1)
X = np.random.rand(n,d) # fake input matrix with n rows of d-dimensions
import tsensor
with tsensor.clarify():
Y = W @ X.T + b
#Y = W @ X.T + b # pass all X instances through layer
$ python test.py
Traceback (most recent call last):
File "test.py", line 11, in <module>
import tsensor
File "/home/shawley/Downloads/tensor-sensor/tsensor/__init__.py", line 29, in <module>
import tsensor.viz
File "/home/shawley/Downloads/tensor-sensor/tsensor/viz.py", line 39, in <module>
import tsensor.analysis
File "/home/shawley/Downloads/tensor-sensor/tsensor/analysis.py", line 27, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
@drscotthawley If you don't have torch installed, you should install with pip install -e .[torch]
pip install tensor-sensor[torch] won't work until @parrt update the pypi package.
currently the pypi package is behind the master branch
@noklam Sorry, huh? My comment is about how I don't want to install torch or the torch dependency in this environment. I'm not installing tensor-sensor[torch]
, only tensor-sensor
. Nor am I wanting to install the [all]
option.
Running pip install -e .[torch]
just starts installing torch again:
~/Downloads/tensor-sensor$ pip install -e .[torch]
Obtaining file:///home/shawley/Downloads/tensor-sensor
Requirement already satisfied: graphviz>=0.14.1 in /home/shawley/anaconda3/envs/spnet/lib/python3.7/site-packages (from tensor-sensor==0.1b2) (0.14.2)
Requirement already satisfied: numpy in /home/shawley/anaconda3/envs/spnet/lib/python3.7/site-packages (from tensor-sensor==0.1b2) (1.19.0)
Requirement already satisfied: IPython in /home/shawley/anaconda3/envs/spnet/lib/python3.7/site-packages (from tensor-sensor==0.1b2) (7.18.1)
Requirement already satisfied: matplotlib in /home/shawley/anaconda3/envs/spnet/lib/python3.7/site-packages (from tensor-sensor==0.1b2) (3.2.2)
Collecting torch
Downloading torch-1.6.0-cp37-cp37m-manylinux1_x86_64.whl (748.8 MB)
|▍ | 8.3 MB 1.4 MB/s eta 0:08:38^C
^C
ERROR: Operation cancelled by user
The environment I'm in is actually set up for Keras. I could do the tensorflow version I suppose if that's required. But the docs didn't seem to indicate the that torch or tensorflow were required.
@drscotthawley Ah, sorry I misunderstood your question. I have opened a separate issue #9 about this, the original issue is only about the installation. this seems to related to the source code always tried to import torch first, I think we could get rid of that dependency with a separate PR later.
Ooops. Sorry. I'm an idiot. forgot to push new pip stuff. Done just now. 0.1b3
Issue: For some reason both
pip install tensor-sensor
pip install tensor-sensor[torch]
attempt to install Tensorflow too.Environment:
Workaround:
pip install tensor-sensor --no-deps
pip install graphviz