ValueError with spacy.load('en_core_web_sm') - anaconda

I'm getting
ValueError: could not broadcast input array from shape (96) into shape (128)
for
spacy.load('en_core_web_sm')
I manually downloaded and installed the model as i'm working on a work computer with download restrictions.
I have followed the instructions to download and copy from this link: https://github.com/explosion/spaCy/issues/3113
Copy the folder
Python35\lib\site-packages\en_core_web_sm
create a folder named en in
Python35\Lib\site-packages\spacy\data
, paste the copied contents to en, and rename the folder as en_core_web_sm-2.0.0.
Copy the
__init__.py
file in en_core_web_sm and paste it in en (that is, the init.py file must be in both
Python35\Lib\site-packages\spacy\data\en and
Python35\Lib\site-packages\spacy\data\en\en_core_web_sm-2.0.0
I am able to run
spacy.load('en_core_web_sm')
but am giving a ValueError instead.
Appreciate all help. Thanks!

I had the same error.
Updated spacy to version 2.1.3.
Now it is working properly.
If you are using Anaconda:
conda install -c conda-forge spacy

In order to let you use the en_core_web_sm model via the shortcut link 'en', spaCy creates a symlink. This means you need to have permissions to do this. See here for more details: https://spacy.io/usage/models#usage-link
A note in case others come across this issue later: Copy-pasting the folder and renaming it is really only the last resort if you can't run the command with admin permissions and you need to be able to load the model via spacy.load('en'). This is usually not the case – you can just install the model and load it via its full name, spacy.load('en_core_web_sm'). In fact, I often prefer this syntax, since it's more explicit and you immediately know which model is loaded.
--Copied from the same link you have mentioned in the question. No Copyright violation.

Download en through terminal then use
spacy.load("en_core_web_sm") it will work..

Related

Installing Julia packages using a .toml file?

I am totally new to Julia!
I would like to install a large number of packages for a project I'm joining.
The project comes with a "Project.toml" file
It seems like there should be a nice way to install all the packages I need for the project, perhaps using the Project.toml file
However, I have not yet found any site that indicates how I might be able to do this.
Could anyone please let me know if what I am doing is possible, and if so, point me to a reference that would show how?
If your Project.toml is located in a folder, like myproject/Project.toml, you can simply start Julia with julia --project=/path/to/myproject, and it will automatically detect the Project.toml file in myproject.
The first time you activate this project, in the REPL, you can switch to Pkg mode by typing ], and type the command instantiate. This will cause the package manager to download and install all of the packages listed in Project.toml and their dependencies.
Another way to switch between projects during interactive use is to run activate /path/to/myproject in Pkg-mode in the REPL.
How to install julia packages from a Project.toml
First, you will have navigate to the folder containing your Project.toml.
cd ../your-folder-containing-the-project.toml-file
in your terminal:
julia --project=.
]
instantiate
or
julia --project=. -e 'using Pkg; Pkg.instantiate()
The other answers went already to the point, but I want to add another important aspect.
If this project comes "only" with a Project.toml file, you will be able to install "sone version" of these packages, eventualy the Project.toml may also give you a range of versions known to work with the project you have been given.
But if this project comes also with a Manifest.toml file you will be able to recreate on your pc the exact environment, will all the exact versions of all dependent packages recursivelly, of the guy that passed you the project, using the ways desctibed in detail in the other answers (e.g. ] activate [folder]; instantiate).

Cannot run git clone or pip install commands

So i'm pretty new to the whole windows repo cloning thing. I installed python 2.7, added the path to my windows cmd and I still cannot run any git clone commands. It shows the following output :
git clone
File "", line 1
git clone
^
I've been scouring the internet for an answer but apparently it should work if I use cmd.
Any help would be appreciated!
git clone
File "", line 1
git clone
^
I have had the same issue recently with 3.7, so I made a new username and it worked. Kind of nice, a clean new Windows profile, even though I just started using it again compared to linux. A pain though.
Make sure all other versions of Python are not installed, or at least affecting the path to the file you need the pip installs to be saved. Python can be saved in a few different locations, and some rare times it has been shown in very obscure places. Check where your file saved on your PC. Probablu C:/ then could be many paths. /Users/UnserNameHere/Windows/ProgramFiles. I would use the search bar in the good old GUI while searching under the C drive (if you have multiple HDD/SDD then pic the one used for the C drive, if nothing comes up try the other drives.
Your looking for a file PythonFoundation I can't remember the entire name, however it will have a very long name Python Foundation are in the name of the file. This is where thing are store and where the path should be sending modules, at least the correct file inside that file.
Also try doing it from other Python versions installed. If you had 3.6 and got 3.7 it doesn't mean 3.6 has been deleted. Also doesn't mean you path, is not set to 3.6 while using 3.7. Same with Python 2, most people or many have both. The pip commands vary between python versions pip3 I believe is used (getting windows and linux a little mixed up right now)
If all fails do it the old fashon way, find the mod, download it, and move it to the python file I mentioned above. The homepage for python should have a tab linking to a page, or it's on the main page, letting you know where it has been known to save. Google how to see he path Pip is taking, or how to see if pip is installed and where, and what paths are set to.

How do I include a Julia file in a Jupyter notebook?

I was able to create a Jupyter notebook for Julia. I then proceeded to create a new folder, and then upload a source file to it.
How can I include this file (as in "include("the_file.jl")).
I am using Windows 10.
TIA.
Henry
Precisely as you would do it in the REPL or anywhere else.
include("the_file.jl")
If this doesn't work for you than you are probably in the wrong folder, which you can check with pwd() and change with cd(path::String).
Alternatively, you can specify the full path rather than the relative path:
include("/full/path/to/the_file.jl")
If you created the folder from within Julia, than you probably want
include("myfolder/the_file.jl")

Full installation instruction of youtube-dl in windows

I have just downloaded the youtube-dl-2014.07.15.tar_2.gz in my windows. At first I want to tell I don't know anything about python. And I already have installed python 2.7. Can anyone give me instruction to execute these scripts?
I have already tried to run...but there is some error like these. "No mudule named youtube-dl"
I want a fresh start. Now I am using windows 8.1 and I have also tried youtube-dl.exe. And there is also problem like screenshot
If I want to get worked both script and program what will I do?Any helps will be appreciated. If you give me instruction from scratch that will be better.
To install youtube_dl in Python on Windows (command from their github):
Tested with Python 3.9 on Windows 10
pip install --upgrade youtube-dl
Now when using it, notice that the name of the Python module is with an underscore.
Because it is a Python module, use it like so:
py -m youtube_dl <video url>
Of course video url is the video you want to download
This seems to be caused by a limitation of py2exe. You may want to file a youtube-dl bug report for moving to a cxfreeze, which should not have that problem. In any case, simply moving the youtube-dl.exe file into another directory such as C:\Users\Shamim should fix the problem.
you need just to put the youtube-dl.exe file in in your home directory or any other location on your PATH.
You can see your PATH in your "Envirenment Variables"

Including date and time in Tex File

The latex file is giving the following error:
! LaTeX Error: File `datetime.sty' not found.
Here is the Latex code: \usepackage{datetime}
Am I missing something?
I am using Debian 3.1 Linux Machine.
I don't use Debian myself, but if I look it up, Debian contains it in the package 'texlive-latex-extra'. If you installed LaTeX via the packet-manager of debian (I think so) the command 'apt-get install texlive-latex-extra' executed as root should install you the needed file. Alternatively you can use a graphical package-manager to install the package.
If your LaTeX Distribution does not load the package automatically, you can try to install it manually according to the readme file here: http://www.ctan.org/pub/tex-archive/macros/latex/contrib/datetime/ Edit: http://www.ctan.org/pkg/datetime
Yes, you are missing the datetime.sty file; you are probably missing the whole package too. What system are you using for managing your (La)TeX installation ? If you tell us you may get more specific advice than I can give.
You need to get the datetime package from CTAN or one of its mirrors and install it into your local texmf tree. Your LaTeX manager will do this for you. You may also be able to configure your LaTeX manager to automatically download and install packages the first time they are requested.

Resources