Python problem - no setup.py

May 13, 2017 10 Replies

Pi B+



I've bought a DHT22 thermometer/humidity reader, as much as anything to see how well it works.



I've found a few references online on how to set it up, and they seem to be consistent with each other, but my install of the software doesn't work.



I've downloaded the software from



formatting link



I've run update and upgrade on my pi, and downloaded the relevant packages :



sudo apt-get install build-essential python-dev python-openssl



So far, so good, no errors reported.



However when I try to run



sudo python setup.py install



I get :



python: can't open file 'setup.py': [Errno 2] No such file or directory



A bit of digging on my Pi shows that there are a large number of setup.py files in /usr/lib/*, but they differ. Does that matter, or do I need to use a specific one for this particular install ?



Thanks



Adrian


To Reply : replace "bulleid" with "adrian" - all mail to bulleid is rejected Sorry for the rigmarole, If I want spam, I'll go to the shops Every time someone says "I don't believe in trolls", another one dies.

On Sat, 13 May 2017 12:04:18 +0100, Adrian declaimed the following:

And where did you PUT the download?

Are you IN the directory containing the downloaded files? Which, BTW, should probably NOT be a system directory.

Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

In message , Dennis Lee Bieber writes

The download is in $HOME (as recommended)

Yes.

Running find on the pi finds many copies of setup.py, but they are all in /usr/lib, none of them are in $HOME.

Thanks

Adrian

To Reply : replace "bulleid" with "adrian" - all mail to bulleid is rejected Sorry for the rigmarole, If I want spam, I'll go to the shops Every time someone says "I don't believe in trolls", another one dies.

So how did you download the files? Where exactly did you put the files, $HOME or $HOME/? What files from the repo can you see?

In message , mm0fmf writes

by running :

git clone --bare

formatting link

$HOME/Adafruit_Python_DHT

drwxr-xr-x 4 pi pi 4096 May 13 11:34 refs

-rw-r--r-- 1 pi pi 73 May 13 11:34 description drwxr-xr-x 2 pi pi 4096 May 13 11:34 info drwxr-xr-x 2 pi pi 4096 May 13 11:34 hooks drwxr-xr-x 2 pi pi 4096 May 13 11:34 branches drwxr-xr-x 4 pi pi 4096 May 13 11:34 objects

-rw-r--r-- 1 pi pi 143 May 13 11:34 config

-rw-r--r-- 1 pi pi 85 May 13 11:34 packed-refs

-rw-r--r-- 1 pi pi 23 May 13 11:34 HEAD

I think this is my first attempt at getting stuff from git, so it is quite likely that I've not downloaded enough stuff.

Thanks

Adrian

To Reply : replace "bulleid" with "adrian" - all mail to bulleid is rejected Sorry for the rigmarole, If I want spam, I'll go to the shops Every time someone says "I don't believe in trolls", another one dies.

I clicked on the git link in my browser and can see the following files:

.github Adafruit_DHT examples source .gitignore LICENSE README.md ez_setup.py setup.py

I clicked the download zip and unzipping that has the files. I did your git command and got the same but I don't use git enough to know what is happening.

Very strange. I don't know why, but I can download the stuff directly using a browser on my Pi (nothing happens), so I've downloaded the zip file on another machine and copied it across. That worked !.

I've now got the software installed and it works (the temperature even looks about right).

Thanks

Adrian

To Reply : replace "bulleid" with "adrian" - all mail to bulleid is rejected Sorry for the rigmarole, If I want spam, I'll go to the shops Every time someone says "I don't believe in trolls", another one dies.

That's your problem. Remove the --bare and try again. You should end up with the files in a directory called Adafruit_Python_DHT (no ".git")

git clone --bare creates a "bare" git repository that only has the version control system files in it and doesn't have a working tree.

Stephen Early

When you download, or better, clone the Adafruit_Python_DHT package:

git clone snipped-for-privacy@github.com:adafruit/Adafruit_Python_DHT.git

it will create a directory called Adafruit_Python_DHT on your machine.

You have to be *in* that directory to run the setup.py, because you need to run the setup.py that belongs to that package.

Note that

formatting link
says you don't need to use sudo if you're using a Pi.

Optionally, I would set this up in a virtual environment, so the Python software you install is isolated.

Inside the Adafruit_Python_DHT directory, create a virtualenv called "env":

virtualenv env

Activate it:

source env/bin/activate

And now run setup.py.

Now the Python libraries you have installed will be available whenever you are in an environment (a terminal session for example) in which you have activated the virtualenv.

Daniele

In message , D.M. Procida writes

Thanks, that's a new one on me, I'll have to do a bit more reading.

Adrian

To Reply : replace "bulleid" with "adrian" - all mail to bulleid is rejected Sorry for the rigmarole, If I want spam, I'll go to the shops Every time someone says "I don't believe in trolls", another one dies.

Try , which is aimed at beginners.

Daniele

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required