python pyfiglet not installing due to NO SUCH FILE OR DIRECTORY - python

package not installing due to NO SUCH FILE OR DIRECTORY
can anyone know how to fix this? I tried to install "python install pyfiglet" in cmd with the same directory as the program file with, but it says CAN'T OPEN FILE AND NO SUCH FILE DIRECTORY

The python command is designed to run Python code, not to install Python modules.
What you are looking for is pip, which is the official package manager, made for installing Python modules hosted on PyPI, and with some hacks, online community sources:
python -m pip install pyfiglet
If Python detects the pip module as non-existent, which is useful in many cases (like installations that did not install pip), use the built-in ensurepip module to install it:
python -m ensurepip
Hope this resolved your problem.

Related

ModuleNotFoundError, but it runs in anaconda (jupyter)

I've installed a module named rauth through terminal with pip3 install rauth command but when I import the module and run the code on Visual Studio Code with python3 interpreter, it gives ModuleNotFoundError: No module named 'rauth' error. But it is indeed installed and I can use it in Anaconda. The package file is stored here.
/Users/puffedricecracker/anaconda3/lib/python3.7/site-packages/rauth
And it seems like all my pip installed packages are stored in that path, but those are imported outside Anaconda with no problem. Tried several other commands as google search suggested.
• pip install instead of pip3 install
• python -m pip install
• python3 -m pip install
Let me know if there is any other information needed to be specified.
this is due to the module is installed into site-packages in Anaconda but not Visual Studio. Can you check if the module exists in Visual Studio folder? Another way to test it is to open Python IDLE and run the import, it should also return an error.
I don't know if this could be an universal solution but there was a way to set where to install a package using pip.
In python shell, find where your python modules usually go. It seemed like most of pip installed packages were installed in the second path so I chose that.
>>> import re
>>> print(re.__file__)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py
>>> import sqlalchemy
>>> print(sqlalchemy.__file__)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sqlalchemy/__init__.py
Uninstall the package using pip uninstall packagename
Reinstall with a path name.
pip install packagename -t /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(In fact, just copy pasting package files (in my case, they were rauth, rauth-0.7.3.dist-info) from anaconda package path in the post worked.)

Install git python library through python regardless of OS

I have developed a tool that my team can use after running the setup.py script. The tool requires this library: https://github.com/c2nes/javalang
How can I make my python setup script install this library on their computer regardless of what OS they are on. They can't run my tool without that library (Some people are on windows, mac, and linux.)
pip can install projects on Github as a dependency too!
All you need to do is, in your requirements.txt, add a line like following:
..
git+https://github.com/c2nes/javalang.git
then install the dependency using:
$ pip install -r requirements.txt
What you are looking for exists on PyPI. Instead of git+https://.. line above, just say: javalang. Oh and BTW, unless they are running old versions of Python, they should already have pip installed. If they don't use your operating systems package manager or get-pip.py as you said.

Getting erros trying to install a new package for Python

I have spent hours trying to install a new package for Python (XlsxWriter) but Ican't figure out how to do it. (I am using Python 2.7.10)
I download the two files from here and copied them into my main Python directory:
https://pypi.python.org/pypi/XlsxWriter
In their documentation they recommended using
'pip install XlsxWriter' to install.
I followed the instructions to install pip from here (downloading file and running 'python get-pip.py'):
https://pip.pypa.io/en/latest/installing/#install-pip
That seemed to work but when I type 'pip install XlsxWriter' it still says "'pip' is not recognized as an internal or external command" e.t.c.
Also, as I had downloaded a tarball, I tried the line tar -zxvf XlsxWriter-0.7.7.tar.gz but it just says tar isn't a recognised command again.
If I load python in the command prompt by just typing 'python' and then try the above commands it just says invalid syntax
Where am I going wrong?
Sorry this is so simple but I have no one to ask in real life and have followed the instructions to install python packages in a few places but still can't get it to work.
try python -m pip install XlsxWriter
invoke it as a python module... Your path may not be properly set to just recognize pip
Add your python installation bin folder to your environment path
The problem is your pip installation. You have make pip work first:
http://pip.readthedocs.org/en/stable/installing/
Then you can do pip install XlsxWriter without downloading the package first.
Alternatively you can unpack the archive (tar -xvf XlsxWriter-0.7.7.tar.gz on Linux/Mac) and then do python setup.py install.

How to install a module on python (windows 7)

I've installed python 3.4 on win7. I need faker module to be installed to run the script.
error:
from faker import Factory
ImportError: No module named 'faker'.
I've downloaded few zip's with faker, but unfortunately have no idea how to install it.
Please give simple instructions, how to make it work.(on windows)
Since you have downloaded the zip source from https://github.com/joke2k/faker according to your comments , you can also do the following after changing to the directory where you have setup.py -
python setup.py install
According to the github page itself, to install using pip do -
pip install fake-factory
Use the Python package tool pip.
Open a command prompt and do
pip install fake-factory
or
python -m pip install fake-factory
See the documentation for more information.

How can I install the python module YAML without ROOT ACCESS ( 'easy_install' and 'pip' are not available)?

I am trying to run a python script that calls the yaml module on a server. I only have writing permissions in my home directory. The server has Python 2.7.3 installed. I do not have root access. Also, neither pip nor easy_install are available.
I have downloaded the package and tried to run
python setup.py install --user
which gives the error
error: can't combine user with with prefix/exec_prefix/home or install_(plat)base
How can I get this to work?
Setting up and using a virtualenv is almost always a good option and as you indicated you can download virtualenv.py, but that won't run (anymore) without pip being installed because it tries to install wheels. On Linux Mint with Python 2.7.6 the script e.g. throws:
OSError: Command /home/ruamel/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools wheel failed with error code 1
You can probably circumvent that by using an older virtualenv.py.
In some other cases it is not feasible to use a virtualenv: e.g. when the system python has all kinds of libraries pre-installed that you need to use and cannot replicate into a local virtualenv. In that case you can download the latest version of ruamel.yaml (of which I am the author) and which is essentially a superset of the PyYAML functionality. When I forked the code I created a setup.py from scratch and it allows you to do
python setup.py install --user
without problem on the `setup.py extracted from the tar.gz file downloaded from PyPI.
Based on the idea of the answer by Anton, these steps worked for me
pip install --user ruamel.yaml
then replace in your script
import yaml
with:
from ruamel.yaml import YAML
yaml=YAML(typ='safe')

Categories